I'm having an issue with the datepicker that I'm hoping someone can help me with. I have a page that needs multiple date fields ( technically it's unlimited because it's availability for rental units. So there are many date ranges that need to be put in for one unit ). instead of creating a separate datepicker instance for each date field in my JS file I created a function called changeDate. This has a passed parameter which is the id of the date field that needs to be changed. For some reason, I have to click in the date field, then click out of it, then click back in it to make the calendar appear. It's if I have to focus, unfocus, then re-focus to get the datepicker to fire. Any help would be great. My code is below:
JS:
function changeDate( sel )
{
var div = "#" + sel;
$(div).datepicker(
{
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
currentText: "Today",
duration: "normal",
maxDate: "+25m",
showAnim: "drop"
});
}
HTML:
<div>
Start Date<input type='text' name='start_date[]' id='start_1' onFocus="changeDate('start_1');">
End Date<input type='text' name='end_date[]' id='end_1' onClick="changeDate('end_1');"
</div>