问题
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.
I also notice in the console I'm receiving "TypeError: $(...).dialog is not a function"
The block it's referencing is this:
$('#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");
}
}]
});
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.
回答1:
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" />
来源:https://stackoverflow.com/questions/24402531/whats-wrong-with-this-code-dialog-is-not-a-function