title: Add class to group specific div on focus with jQuery
body: <p>In the following code, I'm trying to make it so that when an input is selected (focused), that the <code>formhead</code> div in the associated fieldset changes its background color, and on blur it changes back.  I would like to do this by adding a class to that same div on focus, and having that class removed on blur.  jQuery closest is the most similar in concept to what I'm trying to do, but isn't appropriate because it will only target parent divs.  Is there something else that would target the nearest div with that class, without affecting the other classes in the other fieldsets?  Or do I have to get much more specific and id the formheads, etc?</p>
  <pre><code>&lt;fieldset&gt;
  &lt;div class=&quot;formhead&quot;&gt;Heading Title 1&lt;/div&gt;
  &lt;div class=&quot;fieldleft&quot;&gt;
      &lt;label for=&quot;specificinput&quot;&gt;Input Title&lt;/label&gt;
      &lt;input type=&quot;text&quot; class=&quot;forminput&quot; id=&quot;specificinput&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;fieldleft&quot;&gt;
      &lt;label for=&quot;specificinput&quot;&gt;Input Title&lt;/label&gt;
      &lt;input type=&quot;text&quot; class=&quot;forminput&quot; id=&quot;specificinput&quot;&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/fieldset&gt;
  
  &lt;fieldset&gt;
  &lt;div class=&quot;formhead&quot;&gt;Heading Title 2&lt;/div&gt;
  &lt;div class=&quot;fieldleft&quot;&gt;
      &lt;label for=&quot;specificinput&quot;&gt;Input Title&lt;/label&gt;
      &lt;input type=&quot;text&quot; class=&quot;forminput&quot; id=&quot;specificinput&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;fieldleft&quot;&gt;
      &lt;label for=&quot;specificinput&quot;&gt;Input Title&lt;/label&gt;
      &lt;input type=&quot;text&quot; class=&quot;forminput&quot; id=&quot;specificinput&quot;&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/fieldset&gt;
  </code></pre>
  <p>And the jQuery:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt; 
  $(document).ready(function() {
      $('input').focus(function( ){
      $(this).closest('.formhead').addClass('bluebg');
    });
      $('input').focus(function( ){
      $(this).closest('.formhead').removeClass('bluebg');
    });
  });
  &lt;/script&gt; 
  </code></pre>