string - JavaScript to check first word in a textarea of a form -


Is it possible to detect Javascript (or no other language) that the user's word INR (in any case) or * uncertain * as the first word in a text field? If so, can I submit the form, either on submitting or when they type, politely by not calling your phone with this? If they include words anywhere, it's fine, it's just the beginning that we do not want it, thanks.

With a little research you can know that the answer to your question is yes . Your question has been asked many times and has been answered, so to do some research about it, it will be better for you to learn.

How? Please read:

  1.   // First step, grab the text that the user has entered with input Id someTextField var str1 = document.getElementById ("someTextField"). Values; // Specify some value to search, the listed word triggers listed here will be triggered. Var wordfind = ["immediate", "* required"]; // For now, if we convert the user's input, str1, and convert it to a lower case, then try to check that the word 0 is to find the first word (indexOf). 0 means the beginning of the text. Find the first word in the // array (str1.toLowerCase). IndexOf (wordfind [0]) === 0 // adding the second word to the array or || || str1.toLowerCase (). IndexOf (wordsToFind [1] ) === 0) {// Display a message to inform the user Warning ("Please do not you start the message with the word 'instant');}  

If you have a lot of words, you can put them all in the array and loop and try to see that the user's text Lacklist Words


Comments