Immediate Child selectors
Hi,
How can i select immediate children of an element only. Like i have
<div class="widget">
<ul>
<li><a href="google.com">Google</a>
<ul>
<li><a href="Gmail.com">Gmail</a></li>
<li><a href="gdocs.com">Google Docs</a></li>
</ul>
</li>
<li><a href="Microsoft.com">Microsoft</a></li>
<li><a href="yahoot.com">yahoo</a></li>
<li><a href="hotmail.com">Hotmail</a></li>
</ul>
I only want to select the first 'li a' from all child li. what i am currently doing is
$('.widget ul>li>a').attr('href','#');
basically i want ALL the FIRST li links (a) to be changed with #. but that changes all the links under ul.
How can i only select first links only.
Thanks.
</div>