Home > Software engineering >  How can I close a JQuery dialog using a pre-defined function?
How can I close a JQuery dialog using a pre-defined function?

Time:09-18

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!!! :)

CodePudding user response:

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.

  • Related