How do I go about combining this old jQuery code into the v1.7 .on()
?
v1.3 .live()
:
$('#results tbody tr').live({
mouseenter:
function () { $(this).find('.popup').show(); },
mouseleave:
function () { $(this).find('.popup').hide(); }
});
v1.7 .on()
:
$('#results tbody').on('mouseenter', 'tr', function () {
$(this).find('.popup').show();
});
$('#results tbody').on('mouseleave', 'tr', function () {
$(this).find('.popup').hide();
});
I want to pass both event handlers to one .on()
call, but keep the brilliant event delegation .on()
allows me to do.
Thank you!
on()
calls off one selector, but other than that I see no issues. – Rory McCrossan May 17 '12 at 13:46