Jump to content

How does one include multiple modal dialogs on same page?


drayarms

Recommended Posts

Hello, I seem to have just run into a brick wall.  I have 2 modal dialogs on the same webpage, each of which can be triggered by clicking on the appropriate button.  Well The first one seems to prevent the second one from being loaded into the DOM.  I'm going to really simplify the code that I'm working with.

 

jQ

 



$(document).ready(function() {//Picture upload dialog window

  	$("#dialog1").dialog({


    		width: 660,

   		height: 495,

   		dialogClass: "dialog",

    		autoOpen: false,

	position: "center",

    		overlay: { opacity:0.9, background: "black"}


  	});



//Open the modal window when  link1 is clicked

$('#link1').click(function(){ $('#dialog1').dialog('open'); });


  

});




$(document).ready(function() {//Picture upload dialog window

  	$("#dialog2").dialog({


    		width: 660,

   		height: 495,

   		dialogClass: "dialog",

    		autoOpen: false,

	position: "center",

    		overlay: { opacity:0.9, background: "black"}


  	});



//Open the modal window when  link1 is clicked

$('#link2').click(function(){ $('#dialog2').dialog('open'); });


  

});

 

html

 


<div id = "dialog1">  content1 </div> 

<div id = "dialog2"> </div>


<div id = "link1" style = "pointer:cursor">// Link that pop opens modal dialog 1 

<div id = "link2" style = "pointer:cursor">// Link that pop opens modal dialog 2

 

 

Well, the separate dialog windows open when I have just one on them on the page. But when I have two of them as above, just the first one (in this case dialog 1) opens and not the other.  So clearly the first is preventing the second from being loaded or it would seem. How can I fix this?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.