Sunday, 8 September 2013

Use jQuery :has() and :contains() selectors together

Use jQuery :has() and :contains() selectors together

I have a list item element that contains a label element. I want to select
the list item element the :has() selector. Inside the label element there
is text I want to match with :contains(). Is it possible to do both of
these things with a single line of jQuery? If not, what is an elegant way
to select the li element based on the contents of its child label element?
<li>
//I want to select this one
<label>Label 1</label>
//more follows...
</li>

No comments:

Post a Comment