Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

only allow numbers in text input in js

$(document).ready(function() {
  $("#myTextBox").inputFilter(function(value) {
    return /^d*$/.test(value);    // Allow digits only, using a RegExp
  },"Only digits allowed");
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #numbers #text #input #js
ADD COMMENT
Topic
Name
8+7 =