making jquery to allow only numbers in text field
making jquery to allow only numbers in text field

Every day at least 99% percent of web developers search on google “how to use jQuery to allow only numbers in ” the below questions

  1. Making jquery to allow only
  2. How to validate email using jQuery or javascript
  3. How to restrict a certain field from being typed in a particular form field
  4. To avoid by using jQuery or Javascript to preventing pasting of unnecessary characters in form fields.

All the above questions are been asked by people like you in quest of better way to validate form input before it is taking into database.

Importance of this Questions above in development

  • This practice helps to implement data integrity and makes the form validation makes by the database itself easier and faster by performing most of the validation on the client server.
  • The Question practical helps the web application developer to purposely include web application security on user side avoiding unnecessary inject of special codes into the database
  • This practice also enables the client (visitor) or user of a web application if his / her typed in data are correct.

Below are most of the sites that offer solution to the above questions asked by the web developers on google at least 99% percent on daily basis.,,

This sites offer some solution either concerning only the numerical validation or allow some keys when pressed but the problems in the question is non-solved in by the different answers on those websites

Below is a Better solution to all those questions above you and others asked or searched on google while developing your web application

[snippet slug=making-jquery-to-allow-only-numbers-in-text-field-jquery lang=javascript]

Below is How to use the above  snippet in jquery numeric validation and lots more  like Make jQuery to allow only numbers no space in text field use the code below, To Make jQuery allow numbers and spaces in text field use the below code, How to make jQuery allow only letters with no spaces use the code below, Making a text to allow only letters and spaces use the code below, Using jQuery to validate email address use this code below, Allowing alphanumeric characters with spaces in text field, Using jQuery to validate latin alpha numeric characters and spaces

Step by step on how to use that above

  1. Make sure you include (install) google CDN jQuery snippet inside your head tag on your web application page.

For example

[snippet slug=making-jquery-to-allow-only-numbers-in-text-field-google-jquery-cdn lang=javascript]

  1. Include the above jQuery script code in your web page before tag </head>

For example


[snippet slug=making-jquery-to-allow-only-numbers-in-text-field-validation-code lang=javascript]


  1. Then inside body tag code the text field you want to validate include attribute [chars] in every <input> with the name of your preferred validation see the code in the example below

For example

[snippet slug=making-jquery-to-allow-only-numbers-in-text-field-html lang=html]

View Demo

[ARSocial_Lite_Locker id=1]



Please enter your comment!
Please enter your name here