Consider this form:
<form>
<input type="text" value="" placeholder="Enter no. of employee" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(..*)./g, '$1');" required/>
<input type="text" value="" placeholder="Enter Salary" required/>
<input type="submit"/>
</form>
I want a regular expression validation for Enter salary text feild with following:
-
The salary should be separated by commas like this format 1,00,000
-
It should not take any other input except numbers like in the case
of "Enter no. of employee" field
2
Answers
Here is the solution for my problem:
Indian currency:
US Currency:
Working solution:
You can try this:
The salary should be separated by commas like this format 1,00,000
It should not take any other input except numbers like in the case of
"Enter no. of employee" field.