I’m trying some event bindings with jQuery, and I have this simple code in my document ready:
$(document).ready(function() { $('p a').each(function(i, selected){ $(selected).hover( function(event) { alert('over: ' + event.type); }, function(event) { alert('out: ' + event.type); }); } ) });
So, when I move mouse over a link thats inside a paragraph (selector is ‘p a’) alerts pop-up twice. So, mouseenter and mouseleave are fired twice.
This only happens in Google Chrome. In Internet Explorer 7, Firefox 3, Opera and Safari both events are fired only once.
Why is this happening?
I think somehow the alert is actually causing the extra events in Chrome. With the following code I only see one event.