更新时间:2023-11-15 09:33:16
我认为它是使用live
的click
处理程序. live
在document
或body
上附加事件处理程序,并侦听我们通过的选择器.每当您调用getTitles
时,它将附加一个新的处理程序.
I think it is the click
handler using live
. live
attachs event handler on the document
or body
and listens to the selector which we pass. Whenever you call getTitles
it will attach a new handler.
看看您的代码,无需使用live
即可,只需使用click
处理程序即可.
Looking at your code there is no need of using live
just use click
handler it will work fine.
在getTitles
$('a', list).click(function(e) {
getItem($(this).attr('data-trnote'));
});
与getItem
方法相同
$('a', list).click(function(e) {
getItem1($(this).attr('data-flat'), $(this).attr('data-description'));
});