title: Does .toggleClass not work with those inside nest?
body: <p>I use $().toggleClass(); to display and hide inventory, but I notice that those feature inside the nest of the container does not have its property applied at all.</p>
  <p>for example HTML</p>
  <pre><code>   &lt;div id=&quot;container&quot;&gt;
  
        &lt;div id=&quot;inventory&quot; class=&quot;hidden&quot;&gt;
  
          &lt;p&gt;Hello There&lt;/p&gt;
  
        &lt;/div&gt;
  
     &lt;/div&gt;
  </code></pre>
  <p>and then Jquery/Javascript</p>
  <pre><code>else if (button == 'Inventory') {
      
      inventoryWipe();
      lookinventory();
      $(&quot;#container&quot;).toggleClass(&quot;hidden&quot;);
      $(&quot;#inventory&quot;).toggleClass(&quot;hidden&quot;);
  
    }
  </code></pre>
  <p>There is a button, you click on it, it hides the container but inventory is still hidden, by the rule of toggleClass, it should invert both of them, so it will show inventory instead of a container. I assume that since Inventory is nesting inside the container, it no longer works.</p>
  <p>Bonus question, I use <code>$(&quot;something&quot;).insertBefore(&quot;#inventory&quot;);</code> but it does not work for this as it adds element before inventory element rather than put it inside the inventory, how do I do that?</p>