0

I have a textarea for input. I can enter multiple value as comma separated. how do I stop user to enter only 4 digit before and after comma?

example: 1234,5678, etc First number has only comma after 4 digit and last number will not have comma after 4 digit. any help will be great.

Rahul
  • 1
  • there are several ways to do this – Jaromanda X Jul 02 '17 at 22:48
  • We're not here to write your code for you, you need to show us that you've done research and put in the effort to learn as much as you can before you came here. Please read this: [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) – Clonkex Jul 02 '17 at 22:58
  • Possible duplicate of [HTML5 restricting input characaters](https://stackoverflow.com/questions/13607278/html5-restricting-input-characaters) – Dan O Jul 02 '17 at 23:47

1 Answers1

0

use the pattern attribute using regex. It would be something like:

"{[0-9]{4}[,]{1}}+{[0-9]{4}"
kkica
  • 4,034
  • 1
  • 20
  • 40