title: Add class "item_active" to parent LI when a child LI has "item_active"
body: <p>It should be easy, but somehow I didn't get this one yet. Hope you can help me. </p>
  
  <p>Simply: I would like the parent LI to get a class "item_active" added when one of the child LIs have that class too.</p>
  
  <pre><code>&lt;ul class="nav navbar-nav"&gt;
    &lt;li class=""&gt;&lt;a href="main"&gt;&lt;span&gt;Main&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li class="dropdown"&gt;&lt;a href="services" class="dropdown-toggle" data-toggle="dropdown"&gt;&lt;span&gt;Services&lt;/span&gt;&lt;/a&gt;
      &lt;ul class="dropdown-menu"&gt;
        &lt;li&gt;&lt;a href="first"&gt;&lt;span&gt;First&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;li class="item_active"&gt;&lt;a href="second"&gt;&lt;span&gt;Second&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="third"&gt;&lt;span&gt;Third&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="about"&gt;&lt;span&gt;About&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="contact"&gt;&lt;span&gt;Contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>You'll see that the second LI in the sub dropdown menu has the class "item_active". </p>
  
  <p>In this scenario I want jQuery to add the class "item-active" to the LI with the class "dropdown" in my case. </p>
  
  <p>I tried many different things. This is may be most close, yet it did nothing:</p>
  
  <pre><code>$('.navbar-nav li ul li').each(function(){
      if($(this).hasClass('item_active')) {
          $(this).closest('.dropdown').addClass('item_active');
      } 
  });
  </code></pre>
  
  <p><a href="https://jsfiddle.net/Preben/cxnx1147/2/" rel="nofollow noreferrer">Fiddle here</a></p>
  
  <p>I have read many different answers in SO, but not one that solved this. </p>