Hi, I have moved this post for jQuery UI Dialog API redesign to here as that is what the observers of that topic suggested. So this is a repost of one of the comments #21 at http://forum.jquery.com/topic/dialog-api-redesign.
Hi Team,
Love your work and I'd love to know how to post some updates to the existing documentation. I am using a dev pattern of running all my jquery and jquery-ui stuff inside of a $(document).ready(function() { // code in here ;}); construct. And I found the only way I was able to make $('.selector').dialog("open") work was to create an options object and then on the desired event fire $('.selector').dialog(myOptionsObj).dialog("open").
I am on jquery 1.8.3 and jqueryui 1.9.2.
The docs on the jquery-ui website suggest that
$('.selector).dialog({ variousOptions: val , ... });
$('.controllerSelector').click(function() {
$('.selector').dialog("open");
}
But it fails in my context.
My context is a "base" page with multiple jQuery UI remote tabs (remote in the sense that their content is loaded from html files that I control but such content is not necessary static).
I have included the code for the 3 html pages to make the problem/feature repeatable. To see what is either a bug or a feature, one needs to comment out one version of the jQuery code in the document ready function in the tm2.html file and uncomment out the second version of the code. As attached, I have the working jQuery code in the tm2.html file, but to repeat my problem (or thing that I wish to help document if it is a feature), just uncomment out the currently comment out block in tm2.html and remove the /* and */ that is there to show how the jQuery UI code docs fail in this scenario.
It's possible that I misunderstand many aspects of jQuery and jQuery UI, so feel free to just educate me as to what I have misunderstood or let me know how I can help improve the documentation.
and here is the tm2.html page that illustrates the problem. To see the fixed version of the problematic code, leave this file as is; to see the problematic code, remove the "/*" and "*/" from lines 13 and lines 33 respectively and add such corresponding comment block markers to lines lines 33 and end of line 56
<!DOCTYPE html>
<html>
<head>
<title>Illustrate working modal dialog from within doc ready function in a jquery ui remote tabbed context</title>