Howto Close JqueryUi Dialog

I use the extension quickdlgs.

I need to close a dialog after I click on a button on the dialog. This button calls an action that redirects to another view. That should not be rendered inside the dialog. I want to hide the dialog before the redirect is executed.

I tried to register a JQuery Script. But I do not know how to hide the dialog. :blink:


    $('#yt2').click(function() {

       <img src='' class='bbc_emoticon' alt='???' />??


Please give me a hint.

Here are two extracts from some code of mine.

The first simply calls the dialog’s close method.

The second also removes the dialog from the DOM.




$_but = array(



Have you tried to use jui method for it?



[size="2"]is not recommended as this may change over time depending on the elements that you put on your page.[/size]

[size="2"]You have two options:[/size]

[list=1][]Get the id from the widget (->getId() ).[]Provide your own id (as a parameter to the widget).[/list]

Now I registered the following JavaScript on the view:


    $('#convertButton').click(function() {



The above code lets the dialog close, because I found the id of the dialog.

A "not so clean" solution is to destroy your dialog after a slight timeout with window.setTimeout .


Here is my improved code.

I use ‘$jsClsoeDialog’, if I want to close/destroy the dialog explicitally in javascripnt.

The code ‘$jsCloseScript’, attaches this destroy code to the ‘dialogclose’ event.

Basically, the code below, combined with NLSClientScript, allows me to load CJuiDialogs through ajax. In the ‘ajax’ success function, I will call ‘$jsCloseDialog’ code prior to doing “jQuery(‘body’).append(html)”, The view has to be partially rendered in the controller.





	jQuery('#$id').bind('dialogclose',function(){ $jsCloseDialog});


            $this->beginWidget('zii.widgets.jui.CJuiDialog', array(




                            'show' => 'blind',

                            'hide' => 'explode',

                            'modal' => true,

                            'title' => $title,




            echo CHtml::tag('span',array(),$content);