- $("form").submit(function(){
var boolean = true;
$("input").each(function(index, dom){
if($(dom).attr("type") == "text"(or password etc) && $(dom).val() === ""){
$(dom).css("background-color","#FF9FA2");
boolean = false
}else{
$(dom).css("background-color","#FFFFFF");
}
});
return boolean;
});
For the people who are validating each individual form input to see if they are empty. Well here is a solution.