html - jQuery addClass to ul children only -
i have this
<ul> <li class="quiddam"> <a href="">lorem</a> <ul> <li><a href="">ipsum</a></li> <li><a href="">dolores</a></li> </ul> </li> </ul>
if use jquery add class of "brimsom" children of class "quiddam" this:
$(".quiddam").children().addclass("brimsom");
both tag , ul tag children class of "brimsom".
how can add class of "brimsom" children of "quiddam" ul tag only?
both tag , ul tag children class of "brimsom".
that's not correct.
the following code snippet add class "brimson" elements have "quiddam" class, not children elements.
$(".quiddam").addclass("brimsom");
therefore:
<li class="quiddam brimson">
the following script add them children elements:
$(".quiddam *").addclass("brimsom");
however, require ul
children, be:
$(".quiddam ul").addclass("brimsom");
therefore:
<li class="quiddam"> <a href="">lorem</a> <ul class="brimson">
Comments
Post a Comment