I had a coffee code like this.
$('.foo').hover \
(-> $(this).css "cursor", "pointer"), \
(-> $(this).css "cursor", "default")
And I want to apply this function to dynamically appended DOM, so I tried to delegate function by using on()
like this.
As a example I referred this question
$(document).on 'hover', '.foo', (event) ->
$(this).css "cursor", "pointer" if event.type is "mouseover"
$(this).css "cursor", "default" if event.type is "mouseout"
But this code doesn't work at all.
How can I apply the function to dynamically added elements?