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
About

hi there, I am software engineer, working in e-commerce company and passionate about all thing digital. On this blog, I share my experiments with different technology.

Posted in JavaScript

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

What people say about post?
seo hizmeti on Awesome wordpress ecommerce…

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 38 other followers

%d bloggers like this: