Jiew Meng
Jiew Meng

Reputation: 88197

jQuery Delegating to Close Boxy Dialogs

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();
})

Upvotes: 1

Views: 924

Answers (1)

Balint Pato
Balint Pato

Reputation: 1549

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;
});

Upvotes: 3

Related Questions