close dialog by clicking button - JQuery UI

Viewed 30011

I try to create a button that closes "dialog" window in JQuery UI.

To open the dialog i'm using this code:

$(".show .edit_site").click(function (){
    rel = $(this).attr("rel");

    $("#dialog_edit").dialog({
            modal: true,
            open: function () {
                $(this).load("<?= site_url()?>/sites/show_update?id="+rel+"&mode=popup");
            },
            close: function() {
                //some code
            },
            height: 370,
            width: 900,
            title: 'Some title'
     });
}); 

The dialog opened and everything is fine. But now the question is how do I close the dialog by clicking on the button that is inside the dialog?

enter image description here Thank you all and sorry for my terrible English :)


I tried every possible solution, this the only one who works for me:

function close_dialog()
{
    //Close jQuery UI dialog 

    $(".ui-dialog").hide();
    $(".ui-widget-overlay").hide();
}
3 Answers
Related