I wanted to know how I can run a piece of code (attach a mouseenter event) for every day after a user selects a day or changes a month / year?
I tried to attach an event to these events
- beforeShow
- beforeShowDay
- onChangeMonthYear
- onSelect
On hover, I want to highlight the next day on the same line if it exists.
I am currently attaching a moouseenter / mouseleave event to all days after creating the date set by datepicker (which is inline).
I have simplified what I am doing in the JS script below. I need these events to work after selecting a date and after changing the month / year.
JS Fiddle: http://jsfiddle.net/MartinTale/Xx4GS/2/
$("div").datepicker({
changeMonth: true,
changeYear: true,
inline: true,
altField: "#datep"
});
$("tbody td:not(.ui-state-disabled, .active-calendar-cell)").mouseenter(function (e) {
$(this).closest('td').next().find("a").addClass("hover-calendar-cell");
console.log('test');
});
$("tbody td:not(.ui-state-disabled)").mouseleave(function (e) {
$("a.hover-calendar-cell").removeClass("hover-calendar-cell");
console.log('test out');
});
Thanks in advance.