-1

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?

user1765876
  • 121
  • 1
  • 8
  • Try wrapping your custom code in the `ready` function for jQuery http://api.jquery.com/ready/ – Rob Schmuecker May 08 '14 at 11:37
  • @RobSchmuecker well i guess its not the custom code but already created js file by some dev – user1765876 May 08 '14 at 11:40
  • possible duplicate of [Uncaught ReferenceError: jQuery is not defined](http://stackoverflow.com/questions/8886614/uncaught-referenceerror-jquery-is-not-defined) – Anonymous May 08 '14 at 11:43
  • @Anonymous in my question I clearly mentioned that I have seen questions on SO,similar to it – user1765876 May 08 '14 at 11:53
  • @user1765876 Either way, it is a duplicate. The other option would be to cause it as a typographical error, which it may be. But, the main point is that it is the same exact error. Knowing **why** the error occurs allows you to find the solution. – Anonymous May 08 '14 at 19:11

3 Answers3

4

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.

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
2

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

Samy Massoud
  • 4,295
  • 2
  • 35
  • 48
0

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.

King of kings
  • 695
  • 2
  • 6
  • 21