Example 1:
<input type="text" value="0" onkeyup="cleartwoNum(this)"> //Limit input box input can only be numeric:function cleartwoNum(obj) { = (/[^\d]/g, ''); }
Example 2: You can enter the amount
<input type="text" value="0" onkeyup="clearNoNum(this)"> //Limit input box input:function clearNoNum(obj) { //Replace all non-digits first, except for the numbers and. = (/[^\d.]/g, ""); //The first one must be guaranteed to be a number instead of. = (/^\./g, ""); //Certificate that only one appears, but no more. = (/\.{2,}/g, "."); //Please guarantee. It only appears once, but not more than twice = (".", "$#$").replace(/\./g, "").replace("$#$", "."); }
The above example explanation based on the input box covering the English in English is all the content I share with you. I hope you can give you a reference and I hope you can support me more.