0
比方說,我有以下的javascript:如何將獨特事件偵聽器綁定和解除綁定到同一個對象?
$.each(idArray, function (index, value) {
$('#'+value).on('mouseenter', function(event) {
showTooltip();
$(document).on('click', function (event) {
if(!$(event.target).is('#'+value)) {
hideTooltip();
//remove this listener
}
});
});
});
如何刪除每一次它的發射「點擊」偵聽器,有沒有什麼辦法來唯一地識別它們,並從其他地方將其刪除?很明顯,我無法解除文檔元素上的「單擊」。