i am trying to validate my form for empty fields but i am not sure what code i should use can someone please direct me i have tried the following code but its not working
$("validate").submit(function(event){
$(".offset2").each(function(index) {
if ($(this).val() == 0) {
$("#error").css({"display": "inline"}).text("Some of the fields are empty");
event.preventDefault();
}
});
});
==operator actually returnstruefor"" == 0and for"0" == 0, but if the user actually types a0that's obviously not empty...