I am creating a web page where I have an input text field in which I want to allow only numeric characters like (0,1,2,3,4,5...9) 0-9.
How can I do this using jQuery
Something fairly simple using jQuery.validate
$(document).ready(function() { $("#formID").validate({ rules: { field_name: { numericOnly:true } } }); }); $.validator.addMethod('numericOnly', function (value) { return /^[0-9]+$/.test(value); }, 'Please only enter numeric values (0-9)');