admin管理员组

文章数量:1357385

I am getting this error only in chrome for superfish drop down menu. It works fine in Firefox, and IE. It does not work in Chrome. The menu instead of being horizontal list itself Vertical. domain name of clients actual site has been changed below for confidentiality

<script type="text/javascript" src=".js"></script>
<script type="text/javascript" src=".js"></script>
<script type="text/javascript" src=".js"></script>
<script type="text/javascript">
    // initialise plugins
jQuery(function(){
     jQuery('ul.sf-menu').superfish();
    });
</script>

I have even changed it to the following and does not work:

    <script type="text/javascript">
         $(document).ready(function(){
            $('ul.sf-menu').superfish();
         })
    </script>

I looked at the view source and it is referencing two header files. This could be causing the error. I am using magento. The menu is working on all pages of the site except the one page checkout.

Fixed! read below will post as answer when it lets me in 7 hrs

The issue was not with the javascript itself, but with the css for the superfish menu. The developer who designed the layout and coded the template listed the stylesheet for the superfish menu as:

    <link rel="stylesheet" type="text/css" href=".css" media="screen">

After removing the "" and leaving it as "/css/superfish.css" it fixed the menu.

I am getting this error only in chrome for superfish drop down menu. It works fine in Firefox, and IE. It does not work in Chrome. The menu instead of being horizontal list itself Vertical. domain name of clients actual site has been changed below for confidentiality

<script type="text/javascript" src="http://www.domainname./js/jquery.js"></script>
<script type="text/javascript" src="http://www.domainname./js/superfish.js"></script>
<script type="text/javascript" src="http://www.domainname./js/hoverIntent.js"></script>
<script type="text/javascript">
    // initialise plugins
jQuery(function(){
     jQuery('ul.sf-menu').superfish();
    });
</script>

I have even changed it to the following and does not work:

    <script type="text/javascript">
         $(document).ready(function(){
            $('ul.sf-menu').superfish();
         })
    </script>

I looked at the view source and it is referencing two header files. This could be causing the error. I am using magento. The menu is working on all pages of the site except the one page checkout.

Fixed! read below will post as answer when it lets me in 7 hrs

The issue was not with the javascript itself, but with the css for the superfish menu. The developer who designed the layout and coded the template listed the stylesheet for the superfish menu as:

    <link rel="stylesheet" type="text/css" href="http://www.domainname./css/superfish.css" media="screen">

After removing the "http://www.domainname." and leaving it as "/css/superfish.css" it fixed the menu.

Share Improve this question edited May 21, 2012 at 17:59 n_starnes asked May 21, 2012 at 17:33 n_starnesn_starnes 3761 gold badge6 silver badges20 bronze badges 14
  • I changed the actual domain of the website in the code above for client confidentiality. – n_starnes Commented May 21, 2012 at 17:34
  • Did you check your error console? – Ruan Mendes Commented May 21, 2012 at 17:38
  • The error console is where I am getting the error. I am only getting this in chromes error console. – n_starnes Commented May 21, 2012 at 17:39
  • 1 Are you sourcing the scripts from a CDN? Content blockers of various nature might block them – skarmats Commented May 21, 2012 at 17:40
  • 2 @n_starnes: How in heaven's name would that cause a ReferenceError on the jQuery symbol?! – T.J. Crowder Commented May 21, 2012 at 18:03
 |  Show 9 more ments

1 Answer 1

Reset to default 6

The only reasons trying to use the symbol jQuery like that would cause a ReferenceError would be:

  1. If the script include for jQuery failed. Check your console for 404s and the like.

  2. If one of the later scripts actually deletes the jQuery window property, e.g.:

    delete window.jQuery;
    

    Just setting jQuery to undefined (perhaps via noConflict) wouldn't cause a ReferenceError, you'd get undefined is not a function or similar. But if you actually delete the property, then you would. (Except on IE, which won't let you delete properties from the window object.)

本文标签: phpUncaught ReferenceError jQuery is not definedStack Overflow