HTML/CSS Archive

Allow only numbers to be typed in a textbox HTML

Here we will see how to allow only numericĀ  or number to be types in any html textbox. This will be useful for phone number field, pincode or for only numeric authentication purpose. To achieve this you could subscribe for the onkeypress event: HTML TEXTBOX <input type="text" class="textfield" value="" id="phone_number" name="phone_number" onkeypress="return hasNumber(event)" /> Now