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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -