Note that there are some explanatory texts on larger screens.

plurals
  1. PO.each() in a div element, find a child element, set height based on its content (advanced?)
    primarykey
    data
    text
    <p>I need to find each row of divs, and base the height of the h2s in that row based on the h2 that got the most content.</p> <p>I'm trying to loop through a div(main) that cointain divs(child), in that div i got sections(children) and in that section i got a h2. </p> <p>Now based on the content in the h2 that got the most content in it, I set the height of the other h2s with the jQuery library: <a href="http://www.tomdeater.com/jquery/equalize_columns/" rel="nofollow">http://www.tomdeater.com/jquery/equalize_columns/</a></p> <p>I know some jQuery, but not that much that I can figure this out how to do this.</p> <p>Best is to check jsfiddle link <a href="http://jsfiddle.net/CbNRH/13/" rel="nofollow">http://jsfiddle.net/CbNRH/13/</a>. I'm not finished with the script. First I'm trying to find the h2 element and write out its value. Then I thought I would move on, but this is more complex than my knowledge of jQuery. Any help is appreciated.</p> <pre><code>&lt;div id="col-main"&gt; &lt;div class="contain"&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;depending on my content i use .equalizeCols()&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;2&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;/div&gt; &lt;div class="contain"&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;depending on my content i use .equalizeCols()&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;3&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;/div&gt; &lt;div class="contain"&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;depending on my content i use .equalizeCols()&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;section&gt;&lt;div&gt;&lt;h2&gt;6&lt;/h2&gt;&lt;/div&gt;&lt;/section&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="write-out"&gt;&lt;/div&gt; $('#col-main &gt; div').each(function () { var $this = $(this); $('#write-out').text($this.child('section').find('h2').val()); }); div.contain { margin-bottom: 10px; background-color: #dddddd; } div.contain section { padding: 10px; } div.contain section div h2 { font-size: 12px; width: 80px; background-color: red; } div#write-out { font-size: 16px; padding: 10px; background-color: #ffcc00; } </code></pre>
    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.
 

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