Using jQuery in Plone

This took me a little bit to find – Plone changes the standard $ selector to jq.  This was done to avoid conflicts with other Javascript libraries.  So, where I would normally put $(“#divid”), I now put jq(“#divid”).


~ by Liz on October 16, 2008.

5 Responses to “Using jQuery in Plone”

  1. The default way to access jQuery is by it’s name ‘jQuery’, see the end of for other compatible ways to use a shorter name like $ without conflict with other libraries.

  2. You can still use the standard jQuery name, and use the recommended techniques for rebinding jQuery to $ in a local scope (like using (function($) { .. your code using $ .. })(jQuery)). Plugins should work out-of-the-box as jQuery documentation always states that you should never rely on $ being bound.

  3. Thanks for the info, I have only used jQuery a couple of times in the past. I don’t seem to have ever come across that part of the docs.

  4. Is a shorter jq/$ worth to add so much confusion? And readability is with my eyes better with the verbose name jQuery, so I prefer to write jQuery. The size of the script may grow, but usally its delivered zipped, so it doesnt really matter.

  5. Jens – That’s a fair point. I had just been going through the instructions as I used it, and all of their examples used $.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: