How to delegate `hover()` function by using `on()`


This question already has an answer here:


I think you'll need to unbind and add the hover handler. Also, you don't need the line continuations if you're indenting (in this case).

$( -> 


  addFooDiv = -> 
    div = $('<div class="foo">This is another foo div</div>') 

  onLeaveHandler = -> 
    $(this).css "cursor", "pointer"  
    $(this).css "background", "white"

  onEnterHandler = ->   
    $(this).css "cursor", "default"  
    $(this).css "background", "lightblue" # so it's real obvious

  $('.appendFoo').on('click', addFooDiv)

  addFooHandler = ->   
    $(".foo").hover(onEnterHandler, onLeaveHandler)


Props to Sethen Maleno:

Need Your Help

WCF service fires event itself

c# wcf events wcf-client

Is it possible to fire event from service to connected clients without request from client? (I know, if I use client request I could use callback)

Optimal endianness conversions and signed integers

c type-conversion endianness

I am looking for the fastest way to read numerical values stored in binary files.