I’m writing a Greasemonkey script, which should do a simple thing: if there’s a certain string between the <h2> element (always only one on the page) and the first occurrence of an <h3> element (can be several of them or none at all), then … (I’ve already done this part).
I’d be grateful for some help with the conditional.
now I just happen to be familiar with the codes Mikhail are working on.
The basic structure are
The string is not a child of h2, so I don’t think getElementsByTagName would work. Unfortunately there are literally hundreds of div layer with same class id. In this particular case heading is the only unique details in the code. So in my opinion the best way is to find h2 first, go to its parent and store text as string. Then search for the string in the text. Soemthing like this…
As for h3, it may or may not exist, but since its not a sibling, it doesn’t really matter. 🙂 Thank you all for taking your time to answer our question.