jQuery确认对话框 [英] JQuery confirm dialog

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

问题描述

可能重复:
是或否使用jQuery的确认框

Possible Duplicate:
Yes or No confirm box using jQuery

我在这里看到很多有关jQuery标准确认对话框替换的示例,但其中的任何一个都不了解.

I see a lot of examples here about replacements for jQuerys standard confirm dialog but don't understand any of them.

如果我想使用jQuery或jQueryUI弹出确认对话框.我该怎么做并检索用户单击了什么按钮?

If I want to pop-up a confirm dialog using jQuery or jQueryUI. How can i do it and retrieve what button the user clicked ?

肯定必须有一种简单的方法来设置确认对话框,例如alert("Something!");命令.

Surely there must be a simple way to set up a confirm dialog like an alert("Something!"); command.

在其中添加两个按钮,并在yesno上设置回叫功能?

Add two buttons to it and set a call back function on yes or no ?

推荐答案

尝试这个

$('<div></div>').appendTo('body')
  .html('<div><h6>Yes or No?</h6></div>')
  .dialog({
      modal: true, title: 'message', zIndex: 10000, autoOpen: true,
      width: 'auto', resizable: false,
      buttons: {
          Yes: function () {
              doFunctionForYes();
              $(this).dialog("close");
          },
          No: function () {
              doFunctionForNo();
              $(this).dialog("close");
          }
      },
      close: function (event, ui) {
          $(this).remove();
      }
});

小提琴

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

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