The HTML markup for an InputNumber widget looks like this.
Markup |
Copy Code |
---|---|
<input type="text" id="textbox1" /> |
You can initialize the widget with the following jQuery script. The options set in this script create an input that only allows users to enter numbers (no percentages, no currency). The user cannot input anything lower than -100 or higher than 1,000, and the input always displays to the third decimal place, even when the widget holds no value. It also displays a spinner so that users can increase or decrease the value instead of having to type it in.
Script |
Copy Code |
---|---|
<script type="text/javascript"> $(document).ready(function () { $("#textbox1").wijinputnumber( { type: 'numeric', minValue: -100, maxValue: 1000, decimalPlaces: 3, showSpinner: true }); }); </script> |
The markup and script featured here results in the following live widget. Click the spinner buttons to increment and decrement the numbers.