Wednesday, 11 September 2013

Target the child only not the sub-child by Jquery

Target the child only not the sub-child by Jquery

If I have the following Markup
<div class='parent'>
<div class='first'>
First Child
<div class='second'>
Sub-child
</div>
</div>
</div>
and Below is Jquery
$('.parent').children().css("color","#00b3ff");
In result it changes color of both child,as I want to select the First
child only (not by class).

No comments:

Post a Comment