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 -

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

java - How can I send the data from a imput type="file" to the controller? -