Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload