Thanks for looking, all helpful answers are voted up.
This is my markup. I'm trying to find 2 consecutive divs cmk1 and cmk2
with the content RIGHT
and HERE
in consecutive order.
div id 1
shouldn't match because there's aright
but nothere
.div id 3
shouldn't match because there's ahere
but noright
.- I'm trying to find something that looks like
div id 2
whereright
is followed byhere
. Also the text has to be exact:<div>more than right</div>
should not match even though it contains the wordright
What's the most efficient way to do this?
Update: I just had a thought, I could find each
class=cmk1
. if it matches RIGHT, I could select its next
(cmk2) and if it matches also, that's what I'm looking for. But how do I do this while
loop in jquery? and most importantly how do I exit out of it?
<div class="sep" id="1">
<div class="cmk1">right</div>
<div class="cmk2">valc</div>
<div class="opp">vald</div>
<a class="go">Go</a>
</div>
<div class="clear">
<div class="sep" id="12">
<div class="cmk1">RIGHT</div>
<div class="cmk2">HERE</div>
<div class="opp">vala</div>
<a class="go">Go</a>
</div>
<div class="clear">
<div class="sep" id="59">
<div class="cmk1">vale</div>
<div class="cmk2">valf</div>
<div class="opp">here</div>
<a class="go">Go</a>
</div>
<div class="clear">