I have several <div> elements inside another <div>.
<div>
I want to do an if statement which is true if a div inside the top div contains class on.
if
HTML:
<div class="toDiv"> <div> </div> <div class="on"> </div> </div>
jQuery:
if ($(".toDiv").contains("on")) { // do something }
if ($(".toDiv").find(".on").length > 0){ ///do something }
or
if ($(".toDiv .on").length > 0){ ///do something }
1.4m articles
1.4m replys
5 comments
57.0k users