I want to check if the div contains a children with class "error" but with the condition that the error class display is not equal to none. (Meaning error class must be visible.
How can change my code below:
$(".related_field").each(function(){
var $widthAdj = $(this).find(".autoDiv");
if($(this).find(".error").length == 0){ //MUST BE VISIBLE "ERROR" CLASS ONLY
$widthAdj.css("height","48px");
} else {
$widthAdj.css("height","63px");
}
});
You mean like this? Using the :visible
selector:
if($(this).find(".error:visible").length == 0)
$widthAdj.css("height","48px");
} else {
$widthAdj.css("height","63px");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With