title: How to select a nth-child of an id with jquery
body: <p>I am trying to select a nth-child of a div with an id with the help of jquery.
  This is my markup:</p>
  <pre><code>&lt;div id=&quot;burger-wrapper&quot; onclick=&quot;menu()&quot;&gt;
        &lt;span&gt;&lt;/span&gt;
        &lt;span&gt;&lt;/span&gt;
        &lt;span&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  <p>And this is the jquery-selector:</p>
  <pre><code>let firstBurgerSpan = $(&quot;#burger-wrapper span:nth-child(1)&quot;);
  </code></pre>
  <p>But the selected span is &quot;undefined&quot;. Am I missing something or is this the wrong way to select these spans?</p>
  <p>EDIT:</p>
  <p><a href="https://i.stack.imgur.com/nqVW3.png" rel="nofollow noreferrer">This is the output i get when i console-log the selector first, and then try to change the style</a></p>