为什么周选择器未定义?

Why week-picker is undefined?

我正在使用 jQuery UI 1.9.2 的自定义版本,这是 undefined:

$('.week-picker .ui-datepicker-calendar tr').live('mouseover', function() { $(this).find('td a').addClass('ui-state-hover'); });

.live() 在 1.9 更新中被移除。对相同的行为使用事件委托:

$(document).on('mouseover', '.week-picker .ui-datepicker-calendar tr', function(e) {
    $(e.target).find('td a').addClass('ui-state-hover');
});

另请注意,此处理程序中的 this 将绑定到 document。要获取原始元素,请使用 event.target