我是jQuery的新手,并试图在我的PHP应用程序中运行一个非常简单的jQueryUI对话框.在firebug控制台中我收到错误:
uncaught exception: cannot call methods on dialog prior to initialization; attempted to call method 'open'
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: "blind",
hide: "explode"
});
$( "#opener" ).live('click',function() {
$( "#dialog" ).dialog( "open" );
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
我做了一些关于错误的谷歌搜索并没有多少出现,除了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 + "'";
}
...
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?我感谢任何有关此错误消息以及如何解决此问题的帮助.
更新:我试着评论显示/隐藏选项,这对我的问题没有任何影响.以下是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 -->
Run Code Online (Sandbox Code Playgroud)
此HTML包含在PHP文件中,该文件包含在另一个PHP文件中.
the*_*ect 22
好吧,这与我将对话框DIV放在一个尚未加载的PHP文件上的事实有关.所以我将对话框的DIV移动到更高的页面,并且该按钮现在可以在我的应用程序的任何页面上运行.我希望这有助于其他人.
Jos*_*osh 20
我得到了同样的错误.这对我来说是固定的,取自http://forum.jquery.com/topic/jquery-ui-model-dialog-close
$(".ui-dialog-content").dialog().dialog("close");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
90402 次 |
| 最近记录: |