title: how to add/remove a class or style with jquery
body: <p>I have the following code which shows nested ul and hides the other open ones on click.  my question is how can i add a background image to the parent li a that opens the nested ul and removes the background image from the parent li a of the ones it closes?</p>
  
  <p>here is my jquery:</p>
  
  <pre><code>$(document).ready(function() {
      $('ul ul').hide();
  
      $('ul li &gt; a').click(function(event) {
          $('ul ul').hide('slow');
          $(this).parent().find('ul').show('slow');
      });
  
  });;
  </code></pre>