jQuery删除确认框 [英] jQuery delete confirmation box

查看:72
本文介绍了jQuery删除确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的jQuery中,我以表格格式的输出显示结果,我的jQuery的一部分是

In my jQuery am displaying my results in a table formatted output, a part of my jQuery is

<td class='close' onclick='deleteItem(#ITEMID,#ITEMNAME)'></td>

这里"close"是CSS类,在该类中,我具有十字标记图像,如果单击此十字标记,则会触发功能(deleteItem).

here "close" is a CSS class and in this class I have cross mark image, if I click this cross mark the function(deleteItem) will be fired.

我想做的是,如果单击此十字标记,则会弹出一个"delete confirmation box";如果单击是",则应触发该onclick事件,否则,如果单击否,则不会发生任何事情."

here what I want to do is if I click this cross mark a "delete confirmation box" should pop up and if I click yes this onclick event should fire, else if I click No nothing should happen.

我如何实现这一目标,任何人都可以帮助我....

How can I achieve this, can anyone help me....

推荐答案

您需要将Confirm()添加到deleteItem();

You need to add confirm() to your deleteItem();

function deleteItem() {
    if (confirm("Are you sure?")) {
        // your deletion code
    }
    return false;
}

这篇关于jQuery删除确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆