Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用$(…)选择器时出现jquery javascript错误_Javascript_Jquery_Jquery Ui_Jquery Selectors - Fatal编程技术网

使用$(…)选择器时出现jquery javascript错误

使用$(…)选择器时出现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

我正在将一些旧代码迁移到jquery:

 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 UI包,该包将更小(但不在Google托管)。这是在jQuery UI站点本身完成的:

作为一种风格,养成使用jQuery“链接”风格的习惯是很好的:


它节省了一些工作,特别是在选择器比较复杂的情况下。

您确定要同时导入jQuery和jQuery UI“对话框”文件吗?啊……我不知道UI的内容有一个单独的文件,谢谢!我的答案中的链接已经过时了。检查真正的牛肉。
$("#" + ajaxArea).html (xmlHttp.responseText)
  .attr('title', 'Login')
  .dialog({
    height : 140,
    modal : true
  });