I have recently switched from using XPath to using jQuery selectors. I am having trouble with a particular XPath selector I would use:
//h1[contains(.,’Some Title’)]//following::a[1]
Basically I get the first link element from a descendant of a sibling.
From what I understand jQuery selects descendants as “ancestor descedant” and selects siblings as “sibling + sibling”.
How do I combine these when I don’t care/know what the sibling tag is? (In other words “h1 + ul a” works but I want to leave out the ul if possible”
If you have only one sibling for your H1, you can use
If you want to use exactly the NEXT sibling, do