How to make HTML input tag only accept numerical values?

Quick and Easy Code <input type=”text” onkeypress=”return (event.charCode !=8 && event.charCode ==0 || (event.charCode >= 48 && event.charCode <= 57))” /> This will permit usage of numbers and backspace only. If you need decimal part too, use this code fragment <input type=”text” onkeypress=”return (event.charCode !=8 && event.charCode ==0 || ( event.charCode == 46 || (event.charCode …

How to make HTML input tag only accept numerical values? Read More »