I am using the below code to validate a user’s input:
function validateAddress(){
//if it's NOT valid
if(f1.val().length = 0){
f1.addClass("error");
return false;
}
//if it's valid
else{
//whatever
}
My question is: For the user to fill his address I have 3 text_fields. id=f1 – id=f2 – id=f3. In this line
if(my_text_field_id.val().length = 0){
Can I check if any of these values (f1, f2, f3) are empty? (not just one at a time)
Thank you
your html:
and your script would be:
basically using the following jquery selector will select all empty text input