I have an input that as soon as the value is chnaged it submits the value and is saved in our database, therefore we can only allow date format values, and the best tool is using datepicker with a readonly input. the only issue is that once a date is set it cannot be removed (in our case is ok to have empty dates).
<input class="datepicker" readonly="readonly" type="text" />
<script>
$(".datepicker").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-100:+20",
changeYear: true
});
</script>
Is there a method part of datepicker that enables a way to erase the value without interacting with the input, or any other idea on how to accomplish this goal without creating new buttons or complicated UI elements?
Please keep in mind that this question is not about security implications, or if this is the best way to mantain the data integrity of our database, it is a JS / Jquery question. Thanks.