Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with nth-child(), selecting all children
    primarykey
    data
    text
    <p>I might have missed something completely stupid, but I can't figure this out.</p> <p>I am working on some simple jquery practice and was looking to select the specified children from an aside element to get the width. However, when I would select it, the return value was <code>null</code>. So I tried a few things, and I switch nth child value to 2 and the method to html() to see if that would do anything and yes infact, when I use nth-child(2) it selects all children in the aside element.</p> <p>Javascript:</p> <pre><code>var modOneWidth = $('aside:nth-child(1)').width(); console.log(modOneWidth); //returns null var modOneWidth = $('aside:nth-child(2)').html(); console.log(modOneWidth); //returns html of all children in aside </code></pre> <p>Aside Element and it's children (which are placed in a <code>&lt;section&gt;</code> element):</p> <pre><code> &lt;aside&gt; &lt;article&gt; &lt;h2&gt;Module 1&lt;/h2&gt; &lt;p&gt;ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.&lt;/p&gt; &lt;/article&gt; &lt;article&gt; &lt;h2&gt;Module 2&lt;/h2&gt; &lt;p&gt;riosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur&lt;/p&gt; &lt;/article&gt; &lt;article&gt; &lt;h2&gt;Module 3&lt;/h2&gt; &lt;p&gt;ipsum dolor sit arud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.&lt;/p&gt; &lt;/article&gt; &lt;/aside&gt; </code></pre> <p>Again, can't figure out what I'm doing wrong, can it be HTML5 elements? Any help would be greatly appreciated. Thanks a lot</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.
 

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