1
我正在使用jQuery工具提示爲Datatable顯示動態內容。加載動態內容時,舊元素的工具提示在加載新內容後保留。 我已經看到完全相同的問題,但接受的答案似乎並沒有在我的情況下工作。 下面的提示,我加入到整個文檔Jquery工具提示在動態更改DataTable內容後保留
$(document).tooltip({
position: {
my: "center top",
at: "center bottom+10",
using: function(position, feedback) {
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
的使用更改代碼:如下(按類似的問題的建議)並沒有解決我的問題。
using: function(position, feedback) {
/* fix tooltip not hiding problem */
if($(".ui-tooltip").length>1){
// since the new tooltip is already added, there are now 2.
// removing the first one fixes the problem
$(".ui-tooltip")[0].remove();
}
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});