Skip to content Skip to sidebar Skip to footer

Accept Only Number In Input Text Box Without Using Script

How to allow only number in input text box i used the above metho

Solution 1:

Click this for checking how to enter numeric text only in HTML

If you are using HTML5 then use <input type="number">

If you realy wish to get rid of SQL injection Use this

Solution 2:

You can use javascript like:

<inputtype="text" onkeypress="return event.charCode >= 48 && event.charCode <= 57">

The above code only accepts numbers.

If you want to use decimal number then you can use like:

<inputtype="text" onkeypress="return event.charCode >= 46 && event.charCode <= 57">

Try this code, maybe it will help.

Post a Comment for "Accept Only Number In Input Text Box Without Using Script"