That seems to work I was actually going to suggest this solution:
var $relevantInputs = $('input[name^=check_in_date]')
.add('input[name^=check_out_date]');
$relevantInputs
.click(function() {
var $thisInputsValue= $(this).val();
reset_other_types($thisInputsValue);
});
function reset_other_types(type) {
$relevantInputs
.filter(':not([value=' + type + '])')
.val("")
.end();
}
The first two lines grab the relevant inputs (in case there's many on the page). The second line applies a click handler to all of the relevant inputs (remember that jQuery uses implicit iteration, so the click handler is applied to all objects that were matched in the above two lines). Within the click handler (the user has clicked an input) we get the value of the input that the user has clicked and pass it to the reset_other_types function. This function basically resets the value of all the relevant inputs that do not match the one given in the type parameter. Disco! Readable, unobtrusive solution (which means you don't have to maintain all those fugly separate click handlers in the HTML :P). Cheers!