JQuery tips

To increase the efficiency of jQuery, these are some tips:

  1. Use a class or an id attribute to allow one to identify the item(s) more directly. eg. $('#id_name') or $('.class_name')
  2. Cache the selector that is long and used many times. eg. var link=$("div ul li a"); To use it type: $(link)
  3. Troubleshoot with Firebug (http://getfirebug.com/) and minify your code with the Google Closure Compiler(https://developers.google.com/closure/compiler/)
  4. Troubleshoot 2:Use jsFiddle(http://jsfiddle.net/) to test a jQuery code.