Hi Alison, It depends on what you want in your dialogs. You should definitely change the open dialog click event to use a class selector instead of an ID selector so you only have to do something like $(".dialog_link").click(...) once and it is bound to all the links.
Now if each dialog gets its own content you have a few options. 1) Create a new dialog with new content on each click. 2) Copy the content from somewhere in the document and put it in the one dialog (look at the jQuery API functions such as .clone() and .append() ). 3) some other clever thing that I can't think of now, lots of possibilities with the jQuery API On Tue, Oct 27, 2009 at 2:13 PM, Alison C <randomobject2...@yahoo.com>wrote: > > Hi all. COMPLETE newbie - don't even have much basic Javascript > experience - and I'm hoping that this is actually a simple question > and that someone can point me in the correct direction: > > I am trying to make the dialog function in the same way that it does > in the demo page included with the jqueryui custom download. I want to > be able to click a link and have the dialog pop up as a result. In the > script tags within header of the demo page, this code appears: > > // Dialog > $('#dialog').dialog({ > autoOpen: false, > width: 600, > buttons: { > "Ok": function() { > $(this).dialog("close"); > }, > "Cancel": function() { > $(this).dialog("close"); > } > } > }); > > // Dialog Link > $('#dialog_link').click(function(){ > $('#dialog').dialog('open'); > return false; > }); > > > ....which correlates to this link: > > <h2 class="demoHeaders">Dialog</h2> > <p><a href="#" id="dialog_link" class="ui-state-default ui-corner- > all"><span class="ui-icon ui-icon-newwin"></span>Open Dialog</a></p> > > ...which displays this when clicked: > > <!-- ui-dialog --> > <div id="dialog" title="Dialog Title"> > <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do > eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad > minim veniam, quis nostrud exercitation ullamco laboris nisi ut > aliquip ex ea commodo consequat.</p> > </div> > > > I figured out that to make a second link that displays a different > message, I can dupe that chunk of script in the header tag and rename > the relevant bits to "Dialog2" or whatever in the script and in the > new link and dialog text. Problem is - I have, like, 30 links to do > this way on a single page. I imagine that there must be a way to do > this without having to dupe the header script 30 times. > > I was able to figure out how to use the accordion widget on my own > (and even changed some parameters! woo-hoo!), but am stumped by this > one. Any advice or links to relevant archive posts would be > appreciated. I did search the archives, but didn't find anything that > quite made sense (to me). > > Thanks much in advance - Alison > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery-ui@googlegroups.com To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---