jQuery - konvertiere .live () nach .on ()
Wie gehe ich vor, um diesen alten jQuery-Code in der Version 1.7 zu kombinieren?.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();
});
Ich möchte beide Event-Handler an einen übergeben.on()
Anruf, aber behalten Sie die glänzende Ereignisdelegation.on()
erlaubt es mir zu tun.
Vielen Dank!