Jquery Cheat Sheet

From WikiOD

Here is the cheatsheat of Jquery and basic guide on how to use Jquery

Traversing[edit | edit source]

$('.box')
  .children()
  .closest('div')
  .filter(':selected')
  .find('div')
  .has('div')
  .first()
  .next('div')
  .nextUntil('div')

Advanced features[edit | edit source]

Extending selectors[edit | edit source]

$.expr[':'].inline = function (el) {
  return $(el).css('display') === 'inline'
}

Enables $(':inline')

Extend CSS properties[edit | edit source]

$.cssHooks.someCSSProp = {
  get: function (elem, computed, extra) {
  },
  set: function (elem, value) {
  }
}

// Disable "px"
$.cssNumber["someCSSProp"] = true

fn.animate() hooks[edit | edit source]

$.fn.step.someWhatever = function(fx) {
  // ...
}

Credit:rstacruz