jQuery 委托关闭 Boxy 对话框

发布于 2024-09-06 17:58:47 字数 545 浏览 1 评论 0原文

目前,我正在使用以下命令来关闭对话框

<button onClick="Boxy.get(this).hideAndUnload(); return false;">Cancel</button>

,但我想做一些类似

<button class="btnCancel">Cancel</button>

关闭对话框的

操作,我尝试使用 jquery delegate() 来关闭对话框,但它不起作用。仅供参考,我正在使用 ajax 动态加载整个表单。例如。

$.get("add/text.html", function(data) {
  var b = new Boxy(data, {
    title: "Add Text Post",
    modal: true,
  });
  $.getScript("js/tinymce.config.js");
  b.show();
})

currently, i am using the following to close a dialog

<button onClick="Boxy.get(this).hideAndUnload(); return false;">Cancel</button>

but i want to do something like

<button class="btnCancel">Cancel</button>

to close the dialog

i tried to use jquery delegate() to close the dialog but it does not work. fyi, i am loading the whole form dynamically using ajax. eg.

$.get("add/text.html", function(data) {
  var b = new Boxy(data, {
    title: "Add Text Post",
    modal: true,
  });
  $.getScript("js/tinymce.config.js");
  b.show();
})

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人生百味 2024-09-13 17:58:47

Boxy 网站 中,您可以使用 .close css 类:

.关闭

任何具有此类的元素都将被连接以关闭对话框

点击。

至于第二个想法:你尝试过使用这种逻辑吗?

    $('.btnCancel').click(function(){
     Boxy.get(this).hideAndUnload(); return false;
});

From the Boxy website you could use .close css class:

.close

Any elements with this class will be hooked up to close the dialog on

click.

As for a second thought: Have you tried using this kind of logic?

    $('.btnCancel').click(function(){
     Boxy.get(this).hideAndUnload(); return false;
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文