Skip to content

jQuery numericinput localization options

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

By default, jQuery-numericinput creates an input that uses the US-English locale of 1,234,567.88. To control the locale options, you can use below attributes on the input element:

  • data-decimal-separator separates the integer part and the decimal part of the number; it defaults to '.'
  • data-group-separator separates the different groups of the integer part of the number; it defaults to ','
  • data-group-sizes should be a comma-separated list of integers to indicate the group sizes of the integer part; groups are applied right-to-left with the last group repeated as needed; it defaults to 3
  • data-negative-sign is the sign used to indicate a negative number; it defaults to '-'

For example, an input with the following attributes will accept and display numbers formatted as −1'23'456,78:

<input type="text" id="example-numericinput" data-decimal-separator="," 
    data-group-separator="'" data-group-sizes="3,2" data-negative-sign="−" />

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