I know this question is probably very much on the "supposed-to-know" end of things.... but I'll ask anyway.
I have validation js in php forms pages on my site. The validation works fine when I have it in the form .php page
but when I pull it out and put it in a separate .js file, it no longer works
Can someone point me to what piece of knowledge I'm missing?
Here's a fragment of the code:
if (testStr.length == 0) // nothing entered?
for (var i = 0; i <= testStr.length-1; i++) // all spaces?
if (testStr.charAt(i) != " ")
alert("Please enter your first name.");
stuff is so that it's xhtml compliant.
Also, when I do the include (putting the js in a separate file), I do it like this:
Any ideas? Could it be that I am using the DOM incorrectly?