gpt4 book ai didi

jquery-ui - jQueryUI - 未捕获的异常 : cannot call methods

转载 作者:行者123 更新时间:2023-12-03 10:12:41 24 4
gpt4 key购买 nike

我对 jQuery 非常陌生,并试图在我的 PHP 应用程序中运行一个非常简单的 jQueryUI 对话框。在 Firebug 控制台中,我收到错误消息:

uncaught exception: cannot call methods on dialog prior to initialization; attempted to call method 'open'

这是我的代码:
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: "blind",
hide: "explode"
});

$( "#opener" ).live('click',function() {
$( "#dialog" ).dialog( "open" );
return false;
});
});

我在谷歌上搜索了一些错误并没有发现太多,除了 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 + "'";
}
...

有任何想法吗?我很感激有关此错误消息是什么以及如何解决它的任何帮助。

更新:我尝试注释掉显示/隐藏选项,但这对我的问题没有任何影响。下面是 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 -->

此 HTML 包含在一个 PHP 文件中,该文件包含在另一个 PHP 文件中。

最佳答案

好吧,这与我将对话框 DIV 放在我的 JS 加载时尚未加载的 PHP 文件上有关。所以我将对话框的 DIV 移到了更高的页面,该按钮现在可以在我的应用程序中的任何页面上使用。我希望这对其他人有帮助。

关于jquery-ui - jQueryUI - 未捕获的异常 : cannot call methods,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3827830/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com