Three golden rules
Make no assumptions
Use a closure
Use jQuery responsibly
- Already includes jQuery to run your app, or
- Includes a relatively cutting-edge version of jQuery.
A lot of stores have older themes that use jQuery < 1.3 or Prototype.
You should always check to see if jQuery is defined, and establish your minimum version requirement. If your requirement is not met, load the jQuery you need and use it in no conflict mode, like so:
$('body').append('Your app is using jQuery version '+$.fn.jquery);
... what will be added to the storefront page is:
Your app is using jQuery version 1.9.1.