Help with validating a string
The code below checks that a field has been filled out, but I'd like it to validate the existence of a particular string within that field. Its to be used as a friendlier version of captcha.
I've toyed with the X== sections, but this is far too complex for my old brain.
Could anyone spare me 5 minutes and point me in the right direction please.
if (x==null || x=="")
alert("Answer must be filled out");
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
Answer: <input type="text" name="answer">
<input type="submit" value="Submit">