未捕获的TypeError:对象#< Object>没有方法“对话" [英] Uncaught TypeError: Object #<Object> has no method 'dialog'
问题描述
下面是我的JSF代码及其相应的HTML代码,
Below is my JSF code and corresponding HTML code which its gets converted into,
<script type="text/javascript" src="/static-files/js/jquery.min.js"></script>
<script type="text/javascript" src="/static-files/js/functions.js"></script>
<script type="text/javascript" src="/static-files/scripts/jquery-1.6.2.js"></script>
<script type="text/javascript" src="/static-files/scripts/jquery-ui.min.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<ui:composition>
<div id="myForm" style="visibility:hidden">
<a4j:commandLink id="cmdLinkClose" value="No Thanks"></a4j:commandLink>
</div>
<script type="text/javascript">
/* <![CDATA[ */
$("a[id$='cmdLinkClose']").click(function() {
$('#dialog').dialog('close');
});
/* ]]> */
</script>
</ui:composition>
HTML代码:
<a href="#" id="j_id3:cmdLinkClose" name="j_id3:cmdLinkClose"
onclick="A4J.AJAX.Submit('j_id3',event,{'similarityGroupingId':'j_id3:cmdLinkClose'
,'parameters':{'j_id3:cmdLinkClose':'j_id3:cmdLinkClose'} } );return false;">No Thanks</a>
当我单击不,谢谢"链接时,Java Script控制台出现以下异常.
When I click on 'No Thanks' link, am getting below exception in Java Script console.
Uncaught TypeError: Object #<Object> has no method 'dialog'
在我的xhtml页面中也有下面的代码,
And I also have below code in my xhtml page,
<script type="text/javascript">
/* <![CDATA[ */
var $h=jQuery.noConflict();
function myFunction()
{
$h(document).ready(function() {
$h("#myForm").attr("style", "display:block");
$h("#myForm").dialog({
open: function(event, ui) {
jQuery('.ui-dialog-titlebar-close').removeClass("ui-dialog-titlebar-close").html('<span>Close</span>');
},
duration: 800,
height: 300,
minWidth: 300,
width: 300,
position: [490, 160],
zIndex: 99999999,
modal: true,
show: {
effect: 'puff',
duration: 400
},
hide: {
effect: 'puff',
duration: 400
}
});
});
}
myFunction();
/* ]]> */
</script>
在谷歌搜索之后,我了解到这可能是因为未导入相关的Jquery Java Script文件.但是,就我而言,我不确定我需要导入/删除哪个Java脚本.
After googling I learnt that it could be because of not importing relevant Jquery Java Script files. But, in my case am not sure which Java Script I need to import/remove.
更新:
我将jquery-ui.min.js
替换为jquery-1.9.1.min.js
.下面是错误越来越严重了,
I replaced jquery-ui.min.js
with jquery-1.9.1.min.js
. Below is the error am getting now,
推荐答案
似乎您已经包含了三次jQuery库:
Seem like you've included three times jQuery library:
<script type="text/javascript" src="/static-files/js/jquery.min.js"></script>
<script type="text/javascript" src="/static-files/scripts/jquery-1.6.2.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
您只需要添加一次并将其放置在jQuery UI和其他jQuery文件之前
You just need to include once and place it before jQuery UI and your other jQuery file
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="/static-files/js/functions.js"></script>
<script type="text/javascript" src="/static-files/scripts/jquery-ui.min.js"></script>
这篇关于未捕获的TypeError:对象#< Object>没有方法“对话"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!