使用$(…)选择器时出现jquery javascript错误
我正在将一些旧代码迁移到jquery:使用$(…)选择器时出现jquery javascript错误,javascript,jquery,jquery-ui,jquery-selectors,Javascript,Jquery,Jquery Ui,Jquery Selectors,我正在将一些旧代码迁移到jquery: xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { $("#" + ajaxArea).html (xmlHttp.responseText); $("#" + ajaxArea).attr('title', 'Login'); $("#" + ajaxArea).dialog({ height : 140, modal
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
$("#" + ajaxArea).html (xmlHttp.responseText);
$("#" + ajaxArea).attr('title', 'Login');
$("#" + ajaxArea).dialog({
height : 140,
modal : true
});
}
};
其中ajaxArea是HTML中DIV的ID
对话框位基本上改编自jQuery示例:
直到最后一行,所有这些都可以正常工作。Firefox抛出一个错误,该行只显示“$”。有人知道这可能是什么原因吗?jQuery UI代码与“核心”jQuery代码是分开的。您可以从Google的服务器将这两个代码导入到您的应用程序中:
- jQuery:
- 用户界面(全部):
- 用户界面CSS:
它节省了一些工作,特别是在选择器比较复杂的情况下。您确定要同时导入jQuery和jQuery UI“对话框”文件吗?啊……我不知道UI的内容有一个单独的文件,谢谢!我的答案中的链接已经过时了。检查真正的牛肉。
$("#" + ajaxArea).html (xmlHttp.responseText)
.attr('title', 'Login')
.dialog({
height : 140,
modal : true
});