I used the following script earlier and it worked great. Now I get the following error:
Error: cannot call methods on dialog prior to initialization; attempted to call method 'close'. jquery-latest.js (line 507)
If you upgrade to jQueryUI 1.10.1, this no longer causes an error. Usually I just let go, update, and don't worry about it. The problem with this is that it worked in the past, so why not now not to embarrass me? I must be doing some stupid thing than before, but I donβt see it.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jQuery UI Dialog</title> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> <link type="text/css" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" rel="stylesheet" /> <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js" type="text/javascript"></script> <script> $(function() { $("#open").click(function(){$("#dialog").dialog('open');return false;}); $( "#dialog" ).dialog({ modal: true, autoOpen : false, buttons: { Ok: function() { $( this ).dialog( "close" ); } } }); }); </script> </head> <body> <button id="open">Click</button> <div id="dialog" title="What ever"></div> </body> </html>
jquery jquery-ui jquery-ui-dialog
user1032531 03 Mar. '13 at 16:52 2013-03-03 16:52
source share