This can easily end up with surprising behavior which can only be described as the control trying … Try This $(this).closest('.ui-dialog-content').dialog('close'); Jan 07, 2014 10:29 AM. There are two ways to fix this. var dialog; $(document).ready(function(){ dialog = $("#Diag").dialog({ autoOpen:false, //set this to hide at initial stage resizable: false, width: 400, height: "auto", modal: true, title: 'new window', buttons: { "Save Record": addUser, Cancel: function { $(this).dialog("close"); } } }); }) of course this will not work with a . this plugin is really great, but looks like it doesn't work on bootstrap modal-dialog, when I use a selector in bootstrap modal-dialog, I verified it did not work on bootstrap modal-dialog, I am pretty new to jquery, could u please tell me how to fix this issue, thanks a lot! You need to handle the event on the body. Upon closing a dialog, focus is automatically returned to the element that had focus when the dialog was opened. Have you tried simply viewing the form to verify it's configured correctly? $(this).parents(".ui-dialog-content").dialog('close') Delete and Cancel have been assigned to the jQuery UI Dialog. Instead I added the '.closeBtn' class to the close buttons, then wire up the.click handler using Jquery to explicitly call hide on the modals. Change jQueryUI to version 1.11. Using $ (this).dialog ('close'); only works inside the click function of a button within the modal. If your button is not within the dialog box, as in this example, specify a selector: The dialog box should have 3 buttons. This pattern of … If this would be the case I would have to load jquery code twice - not a good solution. Obviously it turns out that jQuery dialog is only loaded for the administrative interface and you have to call in an external script to get it working for anonymous users. Would appreciate some help. Hiding the close button. I have all my CSS, JS and HTML in place but when i click on the "Create new user" the dialog/modal does not appear (the function behind the button does not work). to get it working. This doesn't work because core relies on the jquery ui dialog to create buttons, titles etc. To create a "cancel" button in a dialog, just link to the page that triggered the dialog to open and add the data-rel="back" attribute to your link. in the line right under where you declare the dialog, set $('#mySubmitButton').live('click', function() { mySubmitFunction(); $('#form-dialog').close(); }); – Jason May 29 '10 at 5:26 jQuery UI dialog (‘close’) not working after AJAX call Inside the jQuery document ready event handler, the jQuery UI Dialog Modal Popup plugin is applied to the HTML DIV and the jQuery UI Dialog Modal Popup box is shown. In some cases, you may want to hide the close button, for instance, if you have a close button in the button pane. The usage of the option overlay: false is bad because it makes another option toTop: true not working and the Searching dialog will be placed as the children of jQuery UI Dialog. Jquery dialog is not a function. Using $(this).dialog('close'); only works inside the click function of a button within the modal. If your button is not within the dialog box, as... You can see the structure below: Note that the