这段代码有什么问题?对话框不是函数 [英] What's wrong with this code? dialog is not a function

查看:39
本文介绍了这段代码有什么问题?对话框不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决我在使用 autotab 时遇到的另一个问题.对于这个站点,它只是不工作,当一切都被正确调用时,我不断收到 autotab 未定义.

I'm trying to solve another issue I'm having with autotab. For this site it's just not working, I keep getting autotab is undefined, when everything's being called correctly.

我还注意到在控制台中我收到了TypeError: $(...).dialog is not a function"

I also notice in the console I'm receiving "TypeError: $(...).dialog is not a function"

它引用的块是这样的:

$('#dialog-modal').dialog( {
    position: ['center'],
    autoOpen: false,
    modal: true,
    buttons: [{
        text : "Close",
        "class" : 'closeButtonClass',
        click : function(e) {
            document.getElementById("modalPopup").src = "about:blank";
            $('#dialog-modal').dialog("close");
        }
    }]
});

谁能告诉我哪里出了问题?它是说错误在具有click : function(e) {"的行上,但这不可能是正确的,因为那里没有对 .dialog 的调用.

Can anyone please tell me what could be wrong? It's saying the error is on the line that has "click : function(e) {" but that can't be right, as there's no call to .dialog there.

推荐答案

dialog() 不是标准 jQuery 库中的方法;它是 jQueryUI 的一部分,看起来您尚未将其添加到您的页面中.在包含 jquery.js 之后,将以下代码添加到页面的 head:

dialog() is not a method within the standard jQuery library; it is part of jQueryUI, which it looks like you have not added to your page. Add the following code to the head of your page, after you include jquery.js:

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

这篇关于这段代码有什么问题?对话框不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆