Forums

jQuery and WordPress Theme/Plugin Development (3 posts)

  1. yearginsm
    Member
    Posted 3 weeks ago #

    After toying around with Prototype, I decided to take a look at jQuery and in particular the jQuery Validation plugin:

    http://docs.jquery.com/Plugins/Validation

    I have hit a snag with loading the built-in version of jQuery using wp_enqueue_script('jquery'). The $() functions return "property does not exist" errors. I noticed in the header of the Admin pages that they make a direct call to jQuery() to work with the dashboard feeds.

    My workaround so far has been to just load in a vanilla version of jquery.js, but I am curious if there is a general guideline for using jQuery in WordPress plugins or themes that would differ from the native documentation and tutorials.

    Page in question: http://stephenyeargin.com/contact/

    Other references:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

  2. nickohrn
    Member
    Posted 3 weeks ago #

    You should use the jQuery() function as opposed to the $() function alias. I believe that WordPress goes ahead and calls the no conflict function to restore the $ alias to whatever it was and then reverts to using the jQuery() function.

  3. yearginsm
    Member
    Posted 3 weeks ago #

    That appears to be the fix. I suppose all is well in the interest of playing nice with other libraries.

    http://docs.jquery.com/Using_jQuery_with_Other_Libraries

    Thanks!

Reply

You must log in to post.

About this Topic