Getting Started
jqxFormattedInput represents an input widget for entering numbers in the binary,
octal, decimal or hexadecimal numeral systems. The displayed number can be incremented
or decremented through the widget's spin buttons (optional) and the numeral system
can be changed programmatically or through a pop-up menu (optional).
Every UI widget from jQWidgets toolkit needs its JavaScript files to be included
in order to work properly.
The first step is to create html page and add links to the javascript files and
css dependencies to your project. The jqxFormattedInput widget requires the following
files:
The next step is to create the following structure in the body of the HTML document:
The first child div is for the spin buttons and the second one - for the pop-up
menu button. If you do not need the spin buttons and pop-up, you can initialize
the widget from an input element:
The last step is to initialize the widget by adding the following script to the
html document:
To call a function(method), you need to pass the method name and parameters (if
any) in the jqxFormattedInput's constructor:
$("#jqxFormattedInput").jqxFormattedInput("open");
To get the formatted input's value (the currently displayed number), you need to
do the following:
var value = $("#jqxFormattedInput").val();
To set a property (option), you need to pass the property name and value(s) in the
jqxFormattedInput's constructor:
$("#jqxFormattedInput").jqxFormattedInput({ radix: "hexadecimal" });
To get a property (option), you need to pass the property name to the jqxFormattedInput's
constructor:
var min = $("#jqxFormattedInput").jqxFormattedInput("min");
To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose
that you want to know when the input value (number) is changed:
// bind to 'change' event.
$('#jqxFormattedInput').on('change', function (event) {
});
Basic Sample
The result of the above code is: