Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
jQuery cheatsheet
(function($) {
$.fn.down = function() {
var el = this[0] && this[0].firstChild;
while (el && el.nodeType != 1)
el = el.nextSibling;
return $(el);
// Get object from index to index
$(el); // << return an array of object
$(el).slice(from, to);
// Collapsable div for web - not sure about mobile
// Know when new element is created.
// fucking useful \m/
// $(el)[1] only returns text instead of object
$(el).eq(index).<whatever jquery function>;
We should use this selector more often since we can separate the part or pack of element, so even if we move the js and html structure later. It still works well
// this function will auto bind events to the new element in DOM
// so you don't have to use it manually.
// #GREAT# - This is very nice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment