Skip to content

Instantly share code, notes, and snippets.

View jbrooksuk's full-sized avatar
🧑‍🚀

James Brooks jbrooksuk

🧑‍🚀
View GitHub Profile
@jbrooksuk
jbrooksuk / Raw HTML from element
Created April 12, 2011 08:05
Returns the raw HTML code for a supplied element.
(function($) {
$.fn.nodeHTML = function() {
return jQuery('<div>').append(jQuery(this).clone()).remove().contents().html();
};
})(jQuery);
@jbrooksuk
jbrooksuk / jQuery Create Plugin
Created April 11, 2011 12:28
Creates DOM elements taking an element and a set of attribute properties
(function($) {
$.fn.create = function(el, attr) {
return jQuery(document.createElement(el)).attr(attr).prependTo(this);
}
})(jQuery);