now I just happen to be familiar with the codes Mikhail are working on.
The basic structure are
<div>
<div>
<h2>Something</h2>
<td>We want to search for the string here</td>
<td>We want to search for the string here</td>
</div>
<div>
<h3>Something else</h3>
<td>May contain the same string, but we are only interested if it contains in previous div .</td>
<td>May contain the same string, but we are only interested if it contains in previous div .</td>
</div>
</div>
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...
<script>
var searcharea = jQuery('h2').parent('div').text();
var searchstring = "superstring";
if( searcharea.indexOf( searchstring ) != -1 )
alert("exchange alert to your own things");
</script>
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.
` nested? Is it a sibling? Something else?
– Brock Adams Oct 08 '12 at 16:11