首页 > 解决方案 > 如何使用预定义函数关闭 JQuery 对话框?

问题描述

我想让我的对话框在以下功能后关闭:

function decide(category, choice, price, bool) {
  data.push([category, choice, price, earn]);
}

我尝试过使用 JQuery 的close 方法。如指南所述,我将其设置为对话框的“特征”。有人知道在触发上述功能后如何将对话框设置为关闭吗?

非常感谢您能给我的任何反馈或建议!!!:)

标签: javascriptjqueryjquery-uidialogjquery-ui-dialog

解决方案


考虑以下。

function decide(category, choice, price, bool) {
  data.push([category, choice, price, earn]);
  $(selector).dialog("close");
}

您只需要调用该close方法。$(selector)将需要更改以表示初始化 Dialog 的正确元素。


推荐阅读