I've previously used the following script and it worked perfectly. I am now getting 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, it no longer causes an error. Normally, I would just let it go, upgrade, and not worry about it. Problem with this one is that it worked in the past so why not now is driving me crazy? I must be doing some silly thing different than previously, but I cannot 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>