Easily Add New jQuery Plugins to Your Drupal Site
There are many cool jQuery plugins out there that solve a whole host of problems and add all kinds of sweet functionality to your site. One issue I have had in the past is just trying to manage all these plugins. Where do I put them? How do I get the functionality into the code? I like to keep things tidy, libraries in the sites/all/libraries folder, custom modules in sites/all/modules/custom, contrib modules in sites/all/modules/contrib, thanks for that tip Jonathon! It helps to make me feel better organized and in control.
Enter the jQ module. (http://drupal.org/project/jq). Install jQ, create a sites/all/plugins directory and drop all your downloaded jQuery plugins into it. Then all you have to do to get the added functionality is add one simple line to the bottom of your template.php file.
Example: I needed to ability to clear a field on focus so I downloaded the jQuery Clearfield plugin from http://labs.thesedays.com/projects/jquery/clearfield, copied it to sites/all/plugins and added the following to templates.php
jq_add('jquery.clearfield');Really, it doesn't get much easier than that.