0
How can I write this in Jquery ?
// Restricts input for the given textbox to the given inputFilter. function setInputFilter(textbox, inputFilter) { ["input"].forEach(function(event) { textbox.addEventListener(event, function() { if (inputFilter(this.value)) { this.oldValue = this.value; } else { this.value = ""; } }); }); } // Install input filters. setInputFilter(document.getElementById("value_to_check"), function(value) { return /^\d*[.]?\d*$/.test(value); });
3 Answers
0
Why would you additionally use the jQuery library if the code already works well?
0
I want to convert it in jQuery
0
Better to rewrite in ES6