Question

Here is my website If I open it in Chrome sometime I don't see the menu function on hover. In the console I get this

Uncaught ReferenceError: jQuery is not defined /catalog/view/javascript/journal/pnotify/jquery.pnotify.min.js:1
Uncaught ReferenceError: jQuery is not defined /catalog/view/javascript/journal/cookie.js:1
Uncaught ReferenceError: jQuery is not defined /catalog/view/javascript/jquery/colorbox/jquery.colorbox.js:82
Uncaught ReferenceError: $ is not defined /catalog/view/javascript/jquery/tabs.js:1
Uncaught TypeError: undefined is not a function 

I know this is an old error and I have seen several questions on SO, but none of them helped me

If you open the same site in Firefox , it warns you about some unresponsive JavaScript and once you click OK it works fine, I am not really sure that what is the issue behind this, if it is jQuery issue, it would be difficult to go in each file and debug it, Anyone who can assist me by looking at console logs?

Was it helpful?

Solution

You have set the async attribute to jQuery include script like <script async src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script> remove it.

<script src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script>

In normal circumstances the scripts are executed in the order in which they are included. But since you have used the async flag the execution of core jQuery library will be asynchronous. So there are chances that it will be executed after the rest of script files which needs jQuery library.

OTHER TIPS

Move this line without async

<script src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script>

to the top of your javascript included files
and make sure there is no conflict between jquery and other library

Hi i was also having the same problem. I got the solution too in my way. you just look at my code. if it does the same thing on your project correct it.

function fill_grid()
{
 //some of my work
 var para=new Array();
 para[0]="id";
 para[1]=retcond("");
}
function retcond(posid)
{
//
var cond="where pfid="'19282'";
retcond=cond;
return retcond;
}

The above code was working fine at the first button_click. but at second click gave me the same error you got. now I changed the "retcond()" function into,

function retcond(posid)
{
//
return cond;  
}

Since i didn't declare the variable name, it made me troubled. now it solved. hope this can give you any idea.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top