Open In App

jQuery UI Dialog close Event

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

jQuery UI Close event is triggered when the dialog box is closed.

Learn more about jQuery selectors and events here.

Syntax:

$(".selector").dialog (
   close: function( event, ui ) {
       console.log('closed')
   },

Approach:

  • First, add jQuery Mobile scripts needed for your project.
<link href = 
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
    rel = "stylesheet">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js">
</script>
  • 'Open Dialog' button will trigger the click function (#gfg) that will further open the <textarea> in a dialog (#gfg2).
  • close( event, ui ) : Triggers when we click on close button in the dialog. There is callback function attached to this close.
    • event :  Type -> Event
    • ui : Type -> Object
    • callback function : function( event, ui ) { console.log('closed')}

Example 1:

Output:


Article Tags :

Similar Reads