Is there a function to tell jquery to only do something on the first instance that matches then to stop.
For example I add a class to a LI to an UL with the below but it adds the LI to all ULs under it.
Original code:
Code needed:
Currently Output code:
For example I add a class to a LI to an UL with the below but it adds the LI to all ULs under it.
Code:
$("div#container ul").prepend("<li>Home</li>");
Code:
<ul>
<li>
<ul>
<li>item</li>
</ul>
</li>
</ul>
Code:
<ul>
<li>Home</li>
<li>
<ul>
<li>item</li>
</ul>
</li>
</ul>
Code:
<ul>
<li>Home</li>
<li>
<ul>
<li>Home</li>
<li>item</li>
</ul>
</li>
</ul>
Comment