Using jQuery I'm trying to bind several functions when an element has a hang state.
I would usually use the event function .hover, but after reading some of the tutorials, I read that use is .onbetter, since you can use one event handler to monitor all the bubble events in the document.
However, I am having problems when I connect two functions together like this:
$("element").on( "hover", function() {
console.log("one");
}, function() {
console.log("two");
});
I expected the result to be one two (this was the case if used .hover), but instead I get two two .
Can someone explain what I'm doing wrong, or is this the expected behavior and why?
Reproduced with .hover(...): http://jsfiddle.net/gXSdG/
Reproduced with .on(hover...): http://jsfiddle.net/gXSdG/1/
source
share