Restrict Input Fields to Floatings - jQuery TUS.Float

File Size: 3.4 KB
Views Total: 72
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Restrict Input Fields to Floatings - jQuery TUS.Float

TUS.Float is a small and simple jQuery plugin that limits input fields to floating-point numbers with a defined number of decimal places. 

This can help prevent users from entering invalid characters and non-numeric values in your numeric input fields.

See Also:

How to use it:

1. Download and load the TUS.Float plugin in the document.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.tusfloat.js"></script>

2. Apply the plugin to an input element and specify the decimal limit.

<input type="text" id="float" value="" />
$("#float").keyup(function(){
  $(this).tusfloat({
    // default 2
    decimal: 3
  });
});

This awesome jQuery plugin is developed by uekichinos. For more Advanced Usages, please check the demo page or visit the official website.