Clear val on toggle with boolean
<p>I have a hidden div with form elements in it that I toggle on a radio select option (Think yes/no as the options)</p>

<p>If they select yes, display the div and require the fields, else hide div and clear the fields (if they have entered any value).</p>

<p>I can do all of this except clear the value with passing a boolean flag to the toggle function</p>

<p>Example:</p>

<pre><code>$("[name=nameOfElement]").change(function() {
    var show = $('input[name=nameOfElement]:checked').val() == "true";
    $('#hiddenForm').toggle(show);
    $('#hiddenInput').toggleClass('required',show);
});
</code></pre>

<p>Is there something that clears the value on passed boolean option?</p>

<pre><code>$("[name=nameOfElement]").change(function() {
    var show = $('input[name=nameOfElement]:checked').val() == "true";
    $('#hiddenForm').toggle(show);
    $('#hiddenInput').toggleClass('required',show).valClear(show);
});
</code></pre>

<p>UPDATE: Not looking for a plugin just wanted to know if I could do this without the if/else condition</p>
