I have the following jquery, what is letting the user to fill out additional fields in the form if the check box is checked. What I want is to clear the additional inputs fields values if the check box is unchecked.
$(document).ready(function() {
$('input:checkbox').attr('checked', false);
$('#xml').hide();
$('#checkbox').click(function() {
$('#xml')[this.checked ? "show" : "hide"]();
});
$('input[type="checkbox"]').click(function() {
if (this.checked) {
$('div#xml p label input').attr('required', true);
}
else
$('div#xml p label input').removeAttr('required', true);
//Here should the corresponding code to be pasted
//$('div#xml p label input').val = ('');
});
$(function() {
$("#datepicker").datepicker();
});
});