Allow Only Numeric Input in Text Box Using jQuery
HTML
<input type="text" name="numeric" class='allownumeric'>
<div>Numeric values only allowed</div>
jQuery
$(".allownumeric").keypress(function (event) {
if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
event.preventDefault();
}
});
working demo

Post a Comment