Posts

Showing posts from October, 2019

input type number only jQuery

<script> // Restricts input for each element in the set of matched elements to the given inputFilter. (function($) {   $.fn.inputFilter = function(inputFilter) {     return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {       if (inputFilter(this.value)) {         this.oldValue = this.value;         this.oldSelectionStart = this.selectionStart;         this.oldSelectionEnd = this.selectionEnd;       } else if (this.hasOwnProperty("oldValue")) {         this.value = this.oldValue;         this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);       }     });   }; }(jQuery)); // Install input filters. $("#uintTextBox").inputFilter(function(val...