WebAppers

/ best free open source web resources /

Graphic Resources

25 Excellent Tips and Tricks of jQuery

Posted · Category: Information

jQuery is awesome. Jon Hobbs-Smith has been using it for about a year now The longer he uses it, the more he finds out about it’s inner workings.

He calls myself an “intermediate” jQuery user and he thought some others out there could benefit from all the little tips, tricks and techniques he has learned over the past year. Have a look at the following 25 excellent tips of jQuery, you might be able to learn something from it.

  • Load the framework from Google Code
  • Use a cheat sheet
  • Combine all your scripts and minify them
  • Use Firebug’s excellent console logging facilities
  • Keep selection operations to a minimum by caching
  • Keep DOM manipulation to a minimum
  • Wrap everything in a single element when doing any kind of DOM insertion
  • Use IDs instead of classes wherever possible
  • Give your selectors a context
  • Use chaining properly
  • Learn to use animate properly
  • Learn about event delegation
  • Use classes to store state
  • Even better, use jQuery’s internal data() method to store state
  • Write your own selectors
  • Streamline your HTML and modify it once the page has loaded
  • Lazy load content for speed and SEO benefits
  • Use jQuery’s utility functions
  • Use noconflict to rename the jquery object when using other frameworks
  • How to tell when images have loaded
  • Always use the latest version
  • How to check if an element exists
  • Add a JS class to your HTML attribute
  • Return ‘false’ to prevent default behaviour
  • Shorthand for the ready event

Source: Improve your jQuery – 25 excellent tips

5 Comments
Supported By

Deals

Web Browsers Icon Set
Food Icon Set
Flat Icon Set

Flat Icon Set

100 icons