Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

jQuery cheatsheet

View down_prototype_equivalent.js
1 2 3 4 5 6 7 8
(function($) {
$.fn.down = function() {
var el = this[0] && this[0].firstChild;
while (el && el.nodeType != 1)
el = el.nextSibling;
return $(el);
};
})(jQuery);
View down_prototype_equivalent.js
1 2 3 4
// Get object from index to index
 
$(el); // << return an array of object
$(el).slice(from, to);
View down_prototype_equivalent.js
1 2 3 4
// Collapsable div for web - not sure about mobile
https://github.com/danielstocks/jQuery-Collapse/
// Know when new element is created.
http://docs.jquery.com/Plugins/livequery
View down_prototype_equivalent.js
1 2 3
// fucking useful \m/
// $(el)[1] only returns text instead of object
$(el).eq(index).<whatever jquery function>;
View down_prototype_equivalent.js
1 2 3
/*
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
*/
View down_prototype_equivalent.js
1 2 3 4
// http://api.jquery.com/on/
// 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
Something went wrong with that request. Please try again.