Reputation: 2096
I'm trying to run my jquery code on WP.
I use the correct hook (wp_head
/admin_head
) and dump the script tag
in the head tag
of the page after the the theme has linked jquery but it causes the following error and my script doesn't run.
Uncaught ReferenceError: jquery is not defined
Upvotes: 1
Views: 81
Reputation: 15949
I maybe way out of focus here - and you did not show your whole code ( which is usefull in these cases ) , but ...
from the error message :
Uncaught ReferenceError: jquery is not defined
maybe you need to write jQuery
not jquery
( capital Q
- javascript is case sensitive ) ...
That is ment for the script itself, not the dependencies of wp_enqueue_script()
which do reference jQuery
as jquery
...
Upvotes: 2
Reputation: 5199
Look at the document for wp_enqueue_script. If you look at the $deps parameter, you can use this in order to make sure that jquery gets loaded before your other jQuery calls in other js files.
Upvotes: 1