I have a form with a datepicker. The datepicker has a user-facing d/m/Y formatted datepicker input and a hidden altField to go with it for use with the DB.
If the user clears the text in the input field it doesn't clear the altField as well.
I'm using the below JS to get around this problem. Is there a more correct way to do this or is it perfectly acceptable?
$("#datePicker").change(function(){
if ($(this).val().length < 1){
$("#dateAltField").val('');
}
});