I’m developing a plugin for WordPress. I want to use Ajax for an administration page. Although I know the prototype library (a little), it seems more clever to me to use the jQuery library which is used by WordPress itself. If you don’t know something, you must learn this something: so I started to read the introduction tutorial on the jQuery website. However, the examples there don’t work with WordPress.
What did I do and what does I mean with “don’t work”:
I put the most current version of the jQuery library (1.2.1) in my plugin directory and registered it with wp_register_script using the handle ‘jquery’. When checking the HTML source code of my administration page, I see that the jQuery library from the wp-includes/js directory was included (version 1.1.4). I guess that this is the version used by WordPress using the same handle. It’s from August 2007.
However, trying the first example of the introduction tutorial (http://docs.jquery.com/Tutorials:How_jQuery_Works), it don’t work:
Has the library changed so much from 1.1.4 to 1.2.1 that this basic example don’t work with 1.1.4? If I include the most current version of jQuery on my administration page, the example works. Anyway, my aim is to write a “clean” plugin and the current workaround of loading the new version directly is a somehow dirty way from my point of view.
Why does the example above not work with the jQuery version from WordPress and how can I get it work? Is it ok to replace the jQuery library of WordPress with version 1.2.1 or are there probably other incompatibilities which may take place?
- The topic ‘Using jQuery in own Plugins’ is closed to new replies.