Thank you for the very elegant method for placing an unlimited number of
dialog boxes on a page. Very sweet! Was easy to use and repurpose.


Richard D. Worth-2 wrote:
> 
> At the very least, you can throw your options in a variable and then call
> .dialog(options) 3 times. If you want to take it a few steps further:
> 
> $(function() {
> 
>   var options = {
>       autoOpen: false,
>       width: 600,
>       modal: true
>     };
> 
>   $([1, 2, 3]).each(function() {
>     var num = this;
>     var dlg = $('#helpInfo' + num)
>       .load("includes/file" + num + ".html")
>       .dialog(options);
>     $('#helpLink' + num).click(function() {
>       dlg.dialog("open");
>       return false;
>     });
>   });
> 
> });
> 
> - Richard
> 
> On Tue, Feb 24, 2009 at 11:55 AM, [email protected] <
> [email protected]> wrote:
> 
>>
>> Hi,
>>
>> I have 3 links to difference modal boxes on a page.  Quite messily
>> I've just duplicated the code in the head[1] 3 times, mainly due to
>> being a jQuery/javascript novice.  Is there a way to neaten this up a
>> bit?
>>
>> [1]
>> <script>
>> $(document).ready(function() {
>>        $('#helpInfo1').load("includes/file1.html").dialog({
>>        autoOpen: false,
>>        width: 600,
>>        modal: true
>>        });
>>        $('#helpInfo2').load("includes/file2.html").dialog({
>>        autoOpen: false,
>>        width: 600,
>>        modal: true
>>        });
>>        $('#helpInfo3').load("includes/file3.html").dialog({
>>        autoOpen: false,
>>        width: 600,
>>        modal: true
>>        });
>>        $('#helpLink1').click(function() {
>>      $('#helpInfo1').dialog('open');
>>    });
>>        $('#helpLink2').click(function() {
>>      $('#helpInfo2').dialog('open');
>>    });
>>        $('#helpLink3').click(function() {
>>      $('#helpInfo3').dialog('open');
>>    });
>> });
>> </script>
>>
>>
>> Cheers
>> VK
>> >
>>
> 
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=en
> -~----------~----~----~----~------~----~------~--~---
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Multiple-instances-of-modal-dialog-box-tp22185706s27240p29485018.html
Sent from the jQuery UI Discussion mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.

Reply via email to