简体   繁体   中英

How can I close a JQuery dialog using a pre-defined function?

I want to make my dialog close after the following function:

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

I have tried playing around with JQuery's close method . I set it as a "characteristic" of the dialog as the guide describes. Does anybody know how I can set the dialog to close after the above function has been triggered?

Would really appreciate any feedback or advice you could give me!!! :)

Consider the following.

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

You simply need to call the close method. $(selector) will need to be changed to represent the proper element that Dialog was initialized upon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM