title: jquery change immediate parent attribute from script
body: <p>I'm a jquery newbie</p>
  
  <p>If I have a fieldset like this, how can I add new attributes like class="error" and also modify the text of the legend from the script?</p>
  
  <p>I do not know anything about the fieldset or the legend apart from the fact that they exist</p>
  
  <pre><code>&lt;fieldSet&gt;
      &lt;legend&gt;My Legend&lt;/legend&gt;
      &lt;script type="text/javascript"&gt;
          //I want to select the legend???
      &lt;/script&gt;
  &lt;/fieldset&gt;
  </code></pre>