We have a textbox that we want to both trigger a jQuery UI datepicker, as well as have the ability to enter text freehand into the textbox. We are currently achieving this is with both jQuery UI Mask & DatePicker on the same textbox. However, I had to ‘hack’ the mask to get it to work – because, once you freetext enter: 04/29/19
Then, before you can finish entering the “83” to finish the four digit date, datepicker fires some event that moves the datepicker’s current date to the one you are entering, but, it also deletes the entire date so far. So the goal was to enter the date: 04/29/1983, but the datepicker deleted what I had so far. At first we thought the mask was at fault, but now I just need to figure out how to kill the datepicker event from firing mistakenly. Any help would be so appreciated!
Sorry, code sample:
$('#txbxSocialHistoryDate').datepicker({
showButtonPanel: true,
changeMonth: true,
changeYear: true
});
$('#txbxSocialHistoryDate').mask("99/99/9999", { placeholder: " " });
The above answer definitely works for this question. However, without a trigger button, I came up with a solution, as follows:
So what I did:
This initial mistake led me to the answer.