I have a form with checkboxes, each with a span with some text describing the selection, for isntance:
<input name="people[]" value="953580619" type="checkbox">
<span>Fake person 1</span>
I want to select those checkboxes which have a following span with the word “Fake” appearing in them. How do I select only these checkboxes which have a following::span with the word Fake in them, and no other?
With XPath (since this question had an XPath tag)
This selects
<input>elements which are directly followed by<span>that contains the string “Fake”. Replace the//in that XPath expression with steps matching your document structure, if possible.