plainJS

Functions

JavaScript Functions

Selecting

Selecting DOM elements

  1. Select DOM elements by CSS selector$(selector), $(selector, context)

Traversing

DOM traversing

  1. Get parent element node$.parent(), $.parents()
  2. Get siblings of an element$.siblings(), $.next(), $.nextAll(), $.prev, $.prevAll()

Manipulation

Manipulating DOM elements

  1. Append or prepend to an element$.append(), $.appendTo(), $.prepend(), $.prependTo()
  2. Insert an element after or before another$.after(), $.before(), $.insertAfter(), $.insertBefore
  3. Removing an element$.remove(), $.detach()
  4. Replace a DOM element$.replaceAll(), $.replaceWith()

Attributes

Element attributes

  1. Adding, removing, and testing for classes$.addClass(), $.removeClass(), $.hasClass(), $.toggleClass()

Styles

Element styles, dimensions and positions

  1. Get and set scroll position of an element$.scrollLeft(), $.scrollTop()
  2. Getting width and height of an element$.width(), $.height(), $.outerWidth(), $.outerHeight(), $.innerWidth(), $.innerHeight()

Ajax

Requests without a page load

  1. Send Ajax GET and POST requests$.ajax(), $.get(), $.post(), $.getJSON()

Events

Binding and unbinding events

  1. Binding and unbinding of event handlers$.on(), $.bind(), $.live(), $.click(), $.focus(), $.submit(), etc.
  2. Getting the current mouse position$.mousedown(), $.click(), $.mouse...
  3. Getting the keycode from keyboard events$.keypress(), $.keyup(), $.keydown()
  4. Live binding event handlers$.live(), $.on(), $.bind()
  5. Preventing the default action or bubbling of eventse.preventDefault(), e.stopPropagation()
  6. Trigger an event$.trigger(), $.click(), $.focus(), $.submit(), etc.

Effects

Showing, hiding, fading, animating

  1. Animate an element property$.animate(), $.slideUp(), $.slideDown(), $.fadeIn(), $.fadeOut()
  2. Hide or show an element$.show(), $.hide(), $.toggle()

Utilities

Objects, strings, cookies, timing