How to preserve a child element's bind functions in jQuery/javascript -
How to preserve a child element's bind functions in jQuery/javascript -
i have tags want bind function within jquery's datepicker. however, jquery automatically binds function parent (.ui-datepicker-inline
) div's mouseover
, mouseout
events.
i want override function in cases, when other event occurs, revert default functioning. tried binding mouseover
it's parent div (hasdatepicker
) , worked fine. when unbind parent, child's old bind function stops working well. why this? there way avoid that? don't care if kid keeps it's bind function, long parent's bind it's thing afterward. don't want lose kid functionality when unbind parent.
i have jquery element datepicker
element has original bind (.ui-datepicker-inline
) far can tell jquery ui code.
// binds function, occurring after datepicker's bound function, // , works fine. datepicker.parent().bind('mouseover', hoverweek) // hoverweek function(event) /* ... */ // unbind's datepicker datepicker.parent() datepicker.parent().unbind('mouseover');
can save bound function , set when need it? shouldn't think i'd have to, if did, how go doing that? can datepicker.bind('mouseover')
function bound it?
[update] there few issues: had conflicting code, there issues bubbling effect. solutions listed below both good, , future reference, here solution works: http://jsfiddle.net/redevo/7qpdx/
you can pass function unbind call:
datepicker.parent().unbind('mouseover', hoverweek);
jquery jquery-ui datepicker hover event-bubbling
Comments
Post a Comment