How can I define an alternate close button for jQuery dialog?
I want an anchor with the class "popup-close" to close the open dialog.
Simplest is best!
How can I define an alternate close button for jQuery dialog?
I want an anchor with the class "popup-close" to close the open dialog.
Simplest is best!
This should do the trick:
<div id="dialog" title="Dialog Title" style="border: 1px solid red; position: absolute; display: none">
I'm in a dialog
<span class="popup-close">CLOSE ME!</span>
</div>
<a id="open-dialog-button" href="#">Open Dialog</a>
And your jQuery...
$("#dialog > .popup-close").click(function ()
{
$("#dialog").dialog("close");
});
$("#open-dialog-button").click(function ()
{
$("#dialog").dialog(
{
// Disable close on escape and the default close button for this dialog.
closeOnEscape: false,
open: function(event, ui)
{
$(".ui-dialog-titlebar-close", $(this).parent()).hide();
}
});
});