JQuery test if Div has been hidden and clear form fields if it has been hidden
<p>I have a number of div's that can be expanded using:</p>

<pre><code>$('.adddriver1').click(function(){
$("#additionaldriver1").slideToggle();
return false;
});
</code></pre>

<p>I just change the div id as I need to.
The fields in this div can then be filled out.</p>

<p>If the person clicks the button to hide the div I need to check if anything was entered and then clear the fields.
I am trying:</p>

<pre><code>$("#additionaldriver1").change(function(){
if($("#additionaldriver1").is(":hidden")){
$("#Driver2FirstName").val('');
$("#Driver2LastName").val('');
}
});
</code></pre>

<p>The html is:</p>

<pre><code>     &lt;a href="#"&gt;&lt;img src="images/adddriver.gif" alt="" width="203" height="20" border="0" class="adddriver1" /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;div id="additionaldriver1"&gt;
    &lt;h1&gt;Section 2.2 - &lt;span&gt;Additonal Driver 1 Information&lt;/span&gt;&lt;/h1&gt;
    &lt;table width="100%" border="0" cellspacing="3" cellpadding="3"&gt;

      &lt;tr&gt;

        &lt;td width="34%" valign="middle"&gt;&lt;strong&gt;Additional Driver 1 &lt;/strong&gt;&lt;/td&gt;
        &lt;td colspan="2" valign="middle"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>But it does not clear the fields.
Any help would be appreciated
Thanks in advance, Warren</p>
