I am trying to select an element in the list depending on its html content. I was hoping to do something like $('li[html="something"]'), but of course html isn’t an attribute. Is there an equivalent set based operation?
I could of course iterate all the elements in the list using $.each(), but it seems to me it will be quite a lot slower.
you could try the :contains() selector
http://api.jquery.com/contains-selector/
For an exact match (from the link above):
Usage:
This will only match
<li>John</li>, not<li>A. John</li>, neither<li>John 6</li>… just<li>John</li>!