jquery - Matching element that does not have specific element -


i need run through html blocks .myem class , remove class first div in element if .myem doe not have <p> tags.

this came with, still not remove class. missing?

$('.myem').each(function() {     $(this).not(':has(p)').find('.row:first-child').removeclass('myclass'); }); 

you can in once sweep; many of jquery methods use .each() internally:

$('.myem:not(:has(p)) .row:first-child').removeclass('myclass'); 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -