You could use .filter and .children to select all .elementWrap
objects which have a direct .form_required
child - then find the labels within that subset:
$(".elementWrap").filter(function() {
return $(this).children(".form_required").length;
}).find("label").css({'width':'auto','margin':'0px'});
There is almost always a way to avoid having to use .each
and a lot of if
statements.