Identify an element using the text contents of a child within the element
I have some list elements and I need to apply a style to only the last
three. How can I apply a style to these three? In future versions, they
may not be at the end of the list, so I prefer a version that takes
advantage of a label that appears inside each one as seen below:
<ul>
<li>
//I DON'T want to select this one
</li>
<li>
//I DON'T want to select this one
</li>
<li>
//I DON'T want to select this one
</li>
<li>
//I DON'T want to select this one
</li>
<li>
//I want to select this one
<label>Label 1</label>
//more follows...
</li>
<li>
//I want to select this one
<label>Label 2</label>
//more follows...
</li>
<li>
//I want to select this one
<label>Label 3</label>
//more follows...
</li>
</ul>
No comments:
Post a Comment