Assume that I have some HTML elements like these:
<div id="wrapper">
<ul>
<li><a>Parent 1</a>
<ul>
<li><a>Child 1</a></li>
<li><a>Child 2</a></li>
<li><a>Child 3</a></li>
</ul>
</li>
<li><a>Parent 2</a>
<ul>
<li><a>Child 1</a></li>
<li><a>Child 2</a></li>
<li><a>Child 3</a></li>
</ul>
</li>
</ul>
</div>
How can I set the ID for the first UL element in the #wrapper when $(document) ready??
Thanks in advance!
Try with
:first
likeOr you can try with
:eq(0)
likeEven(May be) you can try with
.eq(0)
likeMake sure that you have this script on
DOM
ready likeAnd please correct your html because it is breaking while closing
ul