-
Noobie if() statement
I feel kind of silly for not being able to see what's wrong with this, but it's starting to drive me mad.
So could someone tell me where I'm going wrong?
PHP Code:
else if(submit_form.price.value == "" || isNaN(submit_form.price.value)=="true"){
alert( "Please enter a price." );
submit_form.price.focus();
return false;
}
Thanks very much,
-
You should use single quotes in the alert statement.
-
I've tried that Curtis, but I'm not having any more luck I'm afraid ...
-
Code:
alert(true == "true"); // false
Can you guess what's wrong?
-
PHP Code:
else if ((submit_form.price.value == "") || (NaN(submit_form.price.value)=="true"))
Try that
-
Doesn't matter if you use single or double quotes in an alert. Adding more parentheses will also not solve the issue that Sorccu points out.