I have a structure of div
s inside div
s, something like this:
<div class='parent'>
<div class='a first'>something here</div>
<div class='a'>something here</div>
<div class='a last'>something here</div>
<div>something here</div>
<div>something here</div>
<div class='a first'>something here</div>
<div class='a'>something here</div>
<div class='a'>something here</div>
<div class='a'>something here</div>
<div class='a last'>something here</div>
<div>something here</div>
<div>something here</div>
<div>something here</div>
<div class='a first last'>something here</div>
</div>
<div class='parent'>
<div>something here</div>
<div class='a first'>something here</div>
<div class='a last'>something here</div>
<div>something here</div>
<div>something here</div>
<div class='a first'>something here</div>
<div class='a'>something here</div>
<div class='a'>something here</div>
<div class='a last'>something here</div>
</div>
As you can see, there are "consecutive blocks" of inner div
s which have class a
. First div
in each block has class first
, and last div
has class last
. Each block is in one parent
div
(block cannot span on 2 or more parent
div
s).
Say I click on one of the inner div
s which has class a
. Is that possible to select only the div
s which are in the same block with the clicked div
?
How would you do this ? (If possible, using jQuery.)