【问题标题】:jQuery is not defined Error and No methodjQuery 未定义错误和无方法
【发布时间】:2012-08-01 11:37:27
【问题描述】:

我正在使用this autocomplete 函数。我在新项目中运行它,它真的很好用。我把它移到了我的主要项目,但它没有用。 我查看了 javascript 控制台,我得到了

Uncaught ReferenceError: jQuery is not defined jquery.autocomplete.js:2
(anonymous function)

Uncaught TypeError: Object [object Object] has no method 'autocomplete'
(anonymous function)
jQuery.fn.extend.ready jquery.js:2299
jQuery.extend.ready.jQuery.readyList jquery.js:2319
jQuery.extend.each jquery.js:745
jQuery.extend.ready jquery.js:2318

我检查了所有路径。

 <script src="jscripts/jquery.js" type="text/javascript"></script>
 <link rel="stylesheet" href="skins/skin_1/jquery.autocomplete.css" type="text/css" />
 <script type="text/javascript" src="jscripts/jquery.autocomplete.js"></script>

<script type="text/javascript">
     $(document).ready(function () {
         $("#Size").autocomplete("AutocompleteData.ashx");
     });
     $(document).ready(function () {
         $("#Color").autocomplete("AutoCompleteData2.ashx");
     });
     $(document).ready(function () {
         $("#Brand").autocomplete("AutoCompleteData3.ashx");
     });    
  </script>

<input type="text" ID="Size" runat="server"/>
<input type="text" ID="Color" runat="server"/>
<input type="text" ID="Brand" runat="server"/>

它适用于普通的 aspx、html 页面。但我必须把它放在 .config 页面中。 它是这样开始的。我不知道我该如何解释。

<PackageTransform>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="urn:asp" exclude-result-prefixes="asp">

通常我有另一个 jQuery 并且它可以工作。像这样;

function moveScroller() {
            var a = function () {
            var b = $(window).scrollTop();
            var d = $("#scroller-anchor").offset().top;
            var c = $("#scroller");
            if (b > d) {
            c.css({ position: "fixed", top: "0px" })
            } else {
            if (d >= b) {
            c.css({ position: "relative", top: "" })
            }
            }
            };
            $(window).scroll(a); a()
            }

我该如何运行它,或者您是否有任何其他使用数据库、键盘箭头和鼠标的自动完成系统。谢谢,对不起我的英语。

【问题讨论】:

  • 顺便说一句,你不需要 3 个 $(document).ready(...) 函数 - 1 个函数可以处理你对 autocomplete 的所有 3 个调用。
  • 谢谢你,我做到了,但仍然无法正常工作
  • 不,那不是为了解决你的问题 - 这是一个观察结果(因此我没有把它作为答案)

标签: jquery asp.net autocomplete


【解决方案1】:

检查 jscripts/jquery.js 文件。你说你已经移动了你的项目,所以可能是该文件没有完全上传,还要检查 jscripts/jquery.autocomplete.js 比较它们的大小并检查它们是否完整上传?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-13
    • 2014-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多