jQuery Tips Everyone Should Know

This is awesome post of AllThingsSmitty, it’s useful for anyone who are web developer.

Original article: https://github.com/AllThingsSmitty/jquery-tips-everyone-should-know


A collection of simple tips to help up your jQuery game.

  1. Checking If jQuery Loaded
  2. Back to Top Button
  3. Preload Images
  4. Checking If Images Are Loaded
  5. Fix Broken Images Automatically
  6. Toggle Classes on Hover
  7. Disabling Input Fields
  8. Stop the Loading of Links
  9. Cache jQuery Selectors
  10. Toggle Fade/Slide
  11. Simple Accordion
  12. Make Two Divs the Same Height
  13. Open External Links in New Tab/Window
  14. Find Element By Text
  15. Trigger on Visibility Change
  16. Ajax Call Error Handling
  17. Chain Plugin Calls

Checking If jQuery Loaded

Before you can do anything with jQuery you first need to make certain it has loaded:

if (typeof jQuery == 'undefined') {
  console.log('jQuery hasn\'t loaded');
} else {
  console.log('jQuery has loaded');

Đọc tiếp “jQuery Tips Everyone Should Know”