On this page you'll find a few examples that demonstrate the jQuery.numeric_input plugin
# Download the production version or the development version and apply the code below <script src="libs/jquery/jquery.js"></script> <script src="dist/jquery.numeric_input.min.js"></script> <script> $(function() { $("input.numeric_input").numeric_input(); }); </script>
$.fn.numeric_input.defaults = { decimal: ',', // char to append when dot or comma is pressed leadingZeroCheck: true, // append a 0 when the first input is a comma or dot initialParse: true, // parse the value on start to match the decimal option parseOnBlur: true, // parse value when user lose focus on field allowNegative: false // allow value to be negative (prepends a minus char) };
You can override the defaults globally. For instance, you can override the global default value for decimal
by defining:
$.fn.numeric_input.defaults.decimal = '.';
$("input.numeric_input").numeric_input();
$("input.numeric_input").numeric_input({ decimal: '.' });
$("input.numeric_input").numeric_input({ leadingZeroCheck: false });
$("input.numeric_input").numeric_input({ initialParse: false });
$("input.numeric_input").numeric_input({ parseOnBlur: false });
$("input.numeric_input").numeric_input({ allowNegative: true });