Wordpress

wp_enqueue_script(), jQuery, and WordPress

jQuery and WordPress

A quick note on using jQuery with WordPress for those having any trouble with it. I decided to use wp_enqueue_script() to include the jQuery library in a recent project and discovered the jQuery code wouldn't do anything.

After a bit of searching, I discovered the solution was to replace all the "$()" in my jQuery code with "jQuery()".

Apparently, in order to prevent collisions with the Prototype javascript framework, which also uses "$()", you have to use jQuery() instead of $() for all your jQuery functions to work with wp_eneque_script().

John Crenshaw
John Crenshaw
President
UFO company founder. 15+ years experience in performance marketing.
Never miss an update
Get more training, case studies and ideas delivered directly to your inbox.
* We never share your personal info.
View our Privacy Policy.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Let’s make something great together
Let’s talk.

Get in touch and we’ll setup a quick call to discuss your needs, what we do, and figure out if we’re a good fit.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.