Note that there are some explanatory texts on larger screens.

plurals
  1. POWrapping divs based on a dynamic class?
    primarykey
    data
    text
    <p>Take the following HTML for example:</p> <pre><code>&lt;div class="container"&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;/div&gt; </code></pre> <p>What result I'm trying to achieve is:</p> <pre><code>&lt;div class="container"&gt; &lt;div class="tabarea"&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;div class="body"&gt;Content&lt;/div&gt; &lt;/div&gt; &lt;div class="tabarea"&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;div class="header"&gt;Content&lt;/div&gt; &lt;/div&gt; &lt;div class="tabarea"&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;div class="footer"&gt;Content&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I've already searched for hours through several topics and have also tried several jQuery combinations(to no avail though), like:</p> <pre><code>$('.container div').each(function(){ $(this).wrap('&lt;div class="tabarea"&gt;&lt;/div&gt;'); }); </code></pre> <p>But this selects every div listed above and wraps in a tabarea classed div.</p> <p>I know I could probably list each class individually, but there will likely be more added in the future. And it has to be done on the client side because the HTML is generated after the tab interface I'm using is called (jQuery UI tabs).</p> <p>Basically, I'm stuck on how to choose the multiple class selectors at once to start the function.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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