javascript - Show/Hide after a div created dynamically -


i use code show/display edit link when mouse hovers on start div. div can created dynamically , when it's created code below doesn't work.

$(".start").hover(         function() {             timeclock.utils.displayedit(this)         },         function() {             timeclock.utils.hideedit(this)         }); 

i tried code below doesn't work , looks wrong. how can implement $(document).on('hover'.....) hide/show edit link shown above?

$(document).on("hover", ".start",         function() {             timeclock.utils.displayedit(this)         },         function() {             timeclock.utils.hideedit(this)         }); 

hover() shortcut binding mouseenter , mouseout handlers. second example doesn't work because on() doesn't take 2 functions that. bind multiple handlers @ once using delegated events this:

$(document).on({     mouseenter: function () {         timeclock.utils.displayedit(this);         },     mouseleave: function () {         timeclock.utils.hideedit(this);     } }, '.start'); 

simple example: http://jsfiddle.net/trcr9/


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -