开发者

Chrome not recognizing jquery plugin

开发者 https://www.devze.com 2023-01-25 19:24 出处:网络
I am trying to use jquery autocomplete plugin in my application. It works well on IE and FF Chrome is behaving wierdly and not calling the function.

I am trying to use jquery autocomplete plugin in my application.

It works well on IE and FF

Chrome is behaving wierdly and not calling the function.

<script type="text/javascript" src="/GIM-WebUI/jquery/jquery-latest.js">jQuery.noConflict();</script>
<link rel="stylesheet" href="/GIM-WebUI/jquery/autocomplete-main.css" type="text/css" />
<script type="text/javascript" src="/GIM-WebUI/jquery/autocomplete.js"></script>

I kept alert dialog box in my autocomplete funct开发者_如何学Pythonion. Both FF and IE pop up the alert message but not chrome. Am I doing something wrong here?

Its erroring out when I call .autocomplete on some dom element. Thank you.


I suspect the problem is here:

<script type="text/javascript" src="/GIM-WebUI/jquery/jquery-latest.js">jQuery.noConflict();</script>
                              -^-                                      -^-

A script tag may either have a src attribute or have code content, not both; from the docs:

If there is a src attribute, the element must be either empty or contain only script documentation that also matches script content restrictions.

I suspect you probably want:

<script type="text/javascript" src="/GIM-WebUI/jquery/jquery-latest.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>

...but only if you really want jQuery not to use the $ symbol (e.g., you'll always use the jQuery symbol instead).

Off-topic: Chrome has a good set of tools built-in for helping you diagnose problems. Press Ctrl+Shift+I to see them (or select the Developer Tools from the wrench menu in the upper right-hand corner). You can look for errors in the Console, set breakpoints, walk through code in the debugger, etc...

0

精彩评论

暂无评论...
验证码 换一张
取 消