earwig75
asked on
Assistance with JavaScript/jQuery validation
I have a button called "letsgo". When it is clicked I want to make sure that both a text area (Notes) and a a text field (theperson) are populated. Could someone help me with the "if" part of my validation below? Thank you.
window.onload = function() {
document.getElementById("letsgo").onclick = function() {
var TextArea = document.getElementsByName("Notes")[0];
var TextField = document.getElementsByName("theperson")[0];
if ..................
{
alert("Please enter a Person and Notes.");
return false;
}
return true;
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for earwig75's comment #a40204804
Assisted answer: 500 points for Randy Poole's comment #a40204765
for the following reason:
The assistance had what I believe was a typo. I also needed both to be required.
Accepted answer: 0 points for earwig75's comment #a40204804
Assisted answer: 500 points for Randy Poole's comment #a40204765
for the following reason:
The assistance had what I believe was a typo. I also needed both to be required.
ahh ok, but you are comparing the same value twice :)
ASKER
Thank you for the assistance.
if (TextArea.value.length==0 || TextArea.value.length==0)