When I\'m giving input type number the letter e and special charecters are also displaying in input field. I want to display only digits. How to block them?
e
You can do it easily using jQuery
Try this code
$(function() { $("#input").keypress(function(event) { if (event.which != 8 && event.which != 0 && (event.which < 48 || event.which > 57)) { $(".alert").html("Enter only digits!").show().fadeOut(2000); return false; } }); });