javascript - How to delegate `hover()` function by using `on()` -
this question has answer here: jquery .on() method multiple event handlers 1 selector 6 answers i had coffee code this. $('.foo').hover \ (-> $(this).css "cursor", "pointer"), \ (-> $(this).css "cursor", "default") and want apply function dynamically appended dom, tried delegate function using on() this. as example referred this question $(document).on 'hover', '.foo', (event) -> $(this).css "cursor", "pointer" if event.type "mouseover" $(this).css "cursor", "default" if event.type "mouseout" but code doesn't work @ all. how can apply function dynamically added elements? i think you'll need unbind , add hover handler. also, don't need line continuations if you're indenting (in ca...