Skip to content

jQuery numericinput minimum and maximum value

Maikel Bos edited this page Feb 11, 2020 · 2 revisions

By default, jQuery-numericinput allows arbitrarily large and small numbers to be input. To control the maximum and minimum allowed value, use the data-maximum-value and data-minimum-value attributes. When a user inputs a number outside this range it is automatically adjusted to be within the range while alerting the user to the error.

For example, an input with the following attributes will accept numbers between -10.000 and +10.000:

<input type="text" id="example-numericinput" data-minimum-value="-10000"
    data-maximum-value="10000" />

<script type="text/javascript">
    $('#example-numericinput').numericinput();
</script>
Clone this wiki locally