Handle dialog Closed action in JavaScript
Description
The following code shows how to handle dialog Closed action.
Example
<!--from w w w . j av a2 s . c om-->
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script type='text/javascript'>
$(document).ready(
function() {
$('div#myDialog').dialog({
autoOpen: false,
show: 'explode',
close: function(e, ui) {
alert(this.id);
}
});
$('input#tmpOpen').click(
function($e) {
$('div#myDialog').dialog('open');
}
);
}
);
</script>
</head>
<body>
<input type='submit' id='tmpOpen' value='Open Dialog' />
<div id='myDialog' title='Lorem Ipsum'>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In
sagittis commodo ipsum. Donec est. Mauris eget arcu. Suspendisse
tincidunt aliquam velit. Maecenas libero. Aliquam dapibus
tincidunt eros. Donec suscipit tincidunt odio. Maecenas congue
tortor non ligula. Phasellus vel elit. Suspendisse potenti. Nunc
odio quam, hendrerit ac, imperdiet sit amet, venenatis sed, enim.
</p>
</div>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Dialog
Add Dialog animation for close event in Jav...
Add ok button to dialog and link with event...
Build jQuery UI Dialog - Animation in JavaS...
Build jQuery UI Dialog - Basic modal in Jav...
Build jQuery UI Dialog - Default functional...
Build jQuery UI Dialog - Modal confirmation...
Build jQuery UI Dialog - Modal form in Java...
Build jQuery UI Dialog - Modal message in J...
Close dialog after pressing OK button in Ja...
Create a Fade in/out dialog in JavaScript
Create a model dialog and turn off auto ope...
Destroy a dialog in JavaScript
Display a dialog to hold the date picker in...
Get the input value from a dialog in JavaSc...
Handle Dialog open/close event in JavaScrip...
Open div tag based dialog with animation in...
Set dialog height in JavaScript
Add Dialog animation for close event in Jav...
Add ok button to dialog and link with event...
Build jQuery UI Dialog - Animation in JavaS...
Build jQuery UI Dialog - Basic modal in Jav...
Build jQuery UI Dialog - Default functional...
Build jQuery UI Dialog - Modal confirmation...
Build jQuery UI Dialog - Modal form in Java...
Build jQuery UI Dialog - Modal message in J...
Close dialog after pressing OK button in Ja...
Create a Fade in/out dialog in JavaScript
Create a model dialog and turn off auto ope...
Destroy a dialog in JavaScript
Display a dialog to hold the date picker in...
Get the input value from a dialog in JavaSc...
Handle Dialog open/close event in JavaScrip...
Handle dialog Closed action in JavaScript
Open a dialog through a button click event ...Open div tag based dialog with animation in...
Set dialog height in JavaScript