Reputation: 570
I have a list as:
<ul>
<li id="l1">1</li>
<li id="l2">2</li>
<li id="l3">hi</li>
</ul>
By using jquery, i got to know if any <li>
contains value(say) hi.
For that i used:
if($('li:contains('hi')')){
alert('Got value');
}
Now i want to know the id of the <li>
in which i found value 'hi'.
How do i get that id?
Upvotes: 2
Views: 1295