I have several inputs that shares a class “date”, each of them get it’s value from DB and are converted to datepickers like this:
$(".date").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy"
});
What I need is that when I click any of the inputs and the datepicker is shown, the default date for that particular datepicker is the one stored in the value, not today’s date.
How can I do that?
I tried the following without success
$(".date").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy",
defaultDate: $(this).val()
});
You might be over-thinking this. Check out this fiddle. Click each input and see the default date being the value of the input.
HTML
JS