How to use the pattern attribute, to specify regular expression to input value

The pattern attribute, when specified is a regular expression which the input value must match the value of pass constraint validation it must be a valid JavaScript regular expression as used by the reg exp type.The pattern attribute specifies a regular expression form control’s value should match. If a non-null value doesn’t conform to the constraints set by the pattern value,… Continue reading How to use the pattern attribute, to specify regular expression to input value

How to force Input field to enter numbers only using JavaScript

As there are many ways to force the input field to take input-only numbers. The two methods by which we can do one of which is using by ASCII code and other is by using the replace() or isNaN() fn. First method : The example below illustrate Input[type=”text”] allows only Numeric Value using Javascript with the help… Continue reading How to force Input field to enter numbers only using JavaScript