【发布时间】:2014-07-16 15:47:03
【问题描述】:
我试图让一个 JQuery 对话框出现,并立即收到错误 $(...).dialog() doesn't exist。我的谷歌搜索显示这通常是由加载 2 个不同的 JQuery 库引起的,但我文件中唯一的脚本标签是用于 JQuery 和 Twitter Bootstrap。这是我的代码(包括改编自 How to implement "confirmation" dialog in Jquery UI dialog? 的对话代码)..
<script src="jquery-1.10.1.min.js"></script>
<script src="js/bootstrap.js"></script>
...
<script>
$(function(){
$("#dialog").dialog({
autoOpen: false,
modal: true
});
$(".deleteLink").click(function(e){
e.preventDefault();
var targetUrl = $(this).attr("href");
$("#dialog").dialog({
buttons : {
"Yes" : function(){
window.location.replace(targetUrl);
},
"No" : function(){
$(this).dialog("close");
}
}
});
});
});
</script>
除了加载多个库或引导程序可能会提供某种干扰之外,还有其他原因可能会导致我收到此错误吗?
【问题讨论】:
标签: javascript jquery jquery-ui twitter-bootstrap dialog