Multiple Modal dialog using jquery

Displying modal dialog using jqurey, sounds familier if you have used jquery before.

just use the following script to display any DIV in model Dialog.

<script type="text/javascript">
$("#DIV1").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
OK: function() {
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
}
});

but what if you want to dispaly one dialog after another, just follow the same logic.

Let’s take an example, I want to diaplay dialog1 and use press “OK” then it will popup another dialog box and so on.
if use clicks on “Cancel” button on first dialog it will close the the existing dialog box.

To do that, on OK button hide the existing dialog and create another .. just like following code

<script type="text/javascript">
$("#DIV1").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
OK: function() {
$(this).dialog("close");
$("#DIV2").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
OK: function() {
$this.dialog("close");
},
Cancel: function() {
$(this).dialog('close');
}
}
},
Cancel: function() {
$(this).dialog('close');
}
}
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s