views:

36

answers:

1

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();
})
+3  A: 

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;
});
Balint Pato
I hadn't looked at the Boxy website (you answered before I found it), but your second suggestion looks like my first-thought on how to effect the OP's intent. Though I'm up-voting for having the sense to recommend using the in-built feature of Boxy itself, rather than complicating things via additional jQuery. Good call =)
David Thomas