How to select the li under the following code [Resolved]

Posted by Kumarkrishna184 under jQuery on 3/31/2016 | Points: 10 | Views : 289 | Status : [Member] | Replies : 2
<ul>
<li>hello</li>
<ul>
<li>krishna</li>
<li>Rajni Sir</li>
</ul>
<li>hi</li>
</ul>

How can i select inner ul lists only using jquery.

Thanks and Regards,
Krishna Kumar



Responses

Posted by: Rajnilari2015 on: 4/1/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Try this selector


$('ul ul > li')


--
Thanks & Regards,
RNA Team

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 4/1/2016 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
You can also try with the Psuedo Selector in Jquery like given below
To Access hello in UnOrdered list use below code
$("ul li:eq(0)")

To access krishna in UnOrdered list you can use below code
 $("ul li:eq(1)")


Sample Demo : http://jsbin.com/mufutaperi/edit?html,output

Thanks,
A2H
My Blog

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response