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); });

30th Jul 2021, 11:13 AM
developer đŸ‘©â€đŸ’»
developer đŸ‘©â€đŸ’» - avatar
3 Answers
0
Why would you additionally use the jQuery library if the code already works well?
30th Jul 2021, 6:53 PM
Solo
Solo - avatar
0
I want to convert it in jQuery
30th Jul 2021, 6:55 PM
developer đŸ‘©â€đŸ’»
developer đŸ‘©â€đŸ’» - avatar
0
Better to rewrite in ES6
30th Jul 2021, 7:30 PM
Solo
Solo - avatar