jQuery Basics

June 08, 2015


// your comment here

Selector Examples:

  • "#selector" select by id
  • ".selector" select by class
  • "p" select by tag
  • ".selector.selector2" select by cross class

Always wrap code in this:

   // jQuery methods go here...

Or this for shorthand:

    // jQuery methods go here...


  • Mouse: click, dbclick, mouseenter, mouseleave
  • Keyboard: keypress, keydown, keyup
  • Form: submit, change, focus, blur
  • Doc/Window: load, resize, scroll, unload

Quicklist of Effect Methods:

  • Basic: show(), hide(), toggle(), delay()
  • Advanced: slideUp(), slideDown(), fadeIn(), fadeOut(), fadeToggle()

Ajax Methods:

  • $.ajax(), $.get(), $.post(), $.load(), ajaxSuccess()

Debugging in Chrome:

  • Push CTRL + Shift + I
  • Or push CTRL + Shift + J


  • Unexpected syntax error on line 1 means you forgot to close });