[英]event click not working same class on multiple anchor tag in td elements
我正在使用dataTables插件將數據顯示為網格,但它們是屬性格式化程序,其中我在td中附加了錨點a並在此上應用類,但是當我綁定事件時,它不觸發而是刷新頁面,我不知道為什么有人可以讓我更正問題所在。
它在網格中顯示完美的圖像以及類顯示,但是當我單擊時,有關單擊事件的行為令人煩惱,它刷新了頁面。
main.js:-
$(".deleteRequest a").click(function (e) {
e.preventDefault();
console.log("click");
var r=confirm("Are u sure you want to delete This Request info");
if (r==true)
{
}
});
formatter: function (timeOutes) {
$.each(timeOutes, function (index, timeOut) {
timeOut.id = '<a attrId = " ' + timeOut.id + '" href="" class="deleteRequest"><i class="icon-trash"></i></a>';
});
}
您需要阻止鏈接默認操作(極有可能回發)-
e.preventDefault(); //add me to your click handler!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.