jquery: problem with unbinding mousenter() upon mouseup()
- by Haroldo
I'm building an interface for marking dates on a calendar as being booked. The user 'paints' on the dates they want to mark as booked.
here's how it looks:
here are the functions:
function load_red_paint(){
$('td').bind('mousedown', function(){
$(this).addClass('booked');
$('td').bind('mouseenter', function(){
$(this).addClass('booked');
});
unbind_brush();
})
}
function unbind_brush(){
$('td').bind('mouseup', function(){
$('td').unbind('mouseenter');
});
$('table').bind('mouseleave', function(){
$('td').unbind('mouseenter');
});
}
the problem:
My unbind_brush() function works great except for if the user mouseup's outside of the calendar, i tried to fix this my also unbinding on mouseleave of that calendar with this bit:
$('table').bind('mouseleave', function(){
$('td').unbind('mouseenter');
});
but with no joy, am i missing something obvious?!!!