Ajax to prevent writing other than the words I specify

Viewed 30

There are words that I have determined. How can I prevent the user from typing words other than those I have specified? in the textarea

example :

$cv= array("job","personel","human","hello", "system","hobby","my life");

I set words in this way, if the user writes something other than these words, the screen should give an error.

1 Answers

You can implement a keyUp listener and parse the value of the textarea - use .split[' '] to get and array with the words and show the error if one of them is not found in your original array using indexOf()

Related