我试图在jQuery中按下删除按钮时发出警报。当我也按下取消选项时,它正在删除。你可以帮助我如何在jQuery中提供删除警报.. 我正在以下列方式使用警报
if(innerHtml == "Delete") {
var r=confirm("do you want to delete this record ?");
if(r==true){
oTable.fnDeleteRow(nRow);
nEditing = null;
nEditingTable = null;
}
}
答案 0 :(得分:1)
你应该这样做..
if(innerHtml == "Delete") {
if(confirm("do you want to delete this record ?")){
oTable.fnDeleteRow(nRow);
nEditing = null;
nEditingTable = null;
}
}
答案 1 :(得分:0)
if(confirm('do you want to delete this record ?')) {
alert('deleted');
} else {
alert('deletion is cancelled');
}
如果这不是问题,请查看innerHtml
值是否为“删除”,如果不是此代码永远不会被执行