0

I have moved my javascript over to another site without modifying it and it should work out of the box as nothing has changed but I keep getting "Uncaught TypeError: undefined is not a function" on two instances.

My first website here works fine.

My second website here does not.

Example with this code as one of the instances but gives me the same error for the same part of code:

<script>
        $(document).ready(function(){
            $('#clock_sydney').jClocksGMT({offset: '+11'});
            $('#clock_greece').jClocksGMT({offset: '+3'});
        });
    </script>

It is telling me there is something wrong with:

$(document).ready(function(){

On both pieces.

Any help would be greatly appreciated as it is driving me insane.

Thanks so much guys!

2 Answers2

0

You are missing the jQuery reference. It is really easy to identify this kind of errors because it said that $ is undefined and $ is the var which represent the jQuery object.

Just include the respective script in your page:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
ianaya89
  • 4,153
  • 3
  • 26
  • 34
0

Looks like your jQuery is in noConflict mode, thus it cant identify $ symbol You can use jQuery() instead of $ or wrap your code like this:

jQuery( document ).ready(function( $ ) {
  // Code that uses jQuery's $ can follow here.
});

more info here

CrowbarKZ
  • 1,203
  • 11
  • 18