我非常新的jQuery和试图在我的程序中运行一个非常简单的jQueryUI对话框。在firebug控制台中我得到的错误:
uncaught exception: cannot call methods on dialog prior to initialization; attempted to call method 'open'@H_502_3@这里是我的代码:
$(function() { $( "#dialog" ).dialog({ autoOpen: false,show: "blind",hide: "explode" }); $( "#opener" ).live('click',function() { $( "#dialog" ).dialog( "open" ); return false; }); });@H_502_3@我做了一些googling的错误,没有太多的反应,除了jquery.ui.js生成错误:
if ( isMethodCall ) { this.each(function() { var instance = $.data( this,name ); if ( !instance ) { throw "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'"; } ...@H_502_3@有任何想法吗?我欣赏任何帮助,这个错误消息是什么,以及如何解决它。
更新:我试图注释显示/隐藏选项,这对我的问题没有任何影响。下面是HTML:
<div class="demo"> <div id="dialog" title="Basic dialog"> <p>This is an animated dialog which is useful for displaying information. The dialog window can be moved,resized and closed with the 'x' icon.</p> </div> <button id="opener">Open Dialog</button> </div><!-- End demo -->@H_502_3@