如何将这个旧的 jQuery 代码合并到 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();
});
我想将两个事件处理程序都传递给一个.on()
调用,但保持出色的事件委托.on()
允许我这样做。
谢谢!