For example, I'm using the script below to check for empty fields :
$('a.submit').click(function() {
if ($('.LoginData').val() == "") {
$('input:text[value=""]').attr('style', 'border-color:#FF0000;');
} else {
$(this).parents('form').submit();
}
});
All the input elements have the class LoginData, so I used the jQuery class selector which selects all the elements containing that class. However, when the if condition finds a field that isn't blank, it just stops there.
I think its a normal behavior for if statements, are there any alternative to this?
Thanks.