/* An outerHTML function written by me that works in Firefox and IE */ $.fn.outerHTML = function (that) { var newElement = document.createElement(this[0].nodeName), newBody = document.createElement('BODY'); newElement.innerHTML = (typeof that === 'string') ? that : (that.jQuery) ? that[0].innerHTML : ''; if (!that) { return newBody.appendChild(this[0].cloneNode(true)).parentNode.innerHTML; } else { this[0].parentNode.replaceChild(newElement, this[0]); return newBody.appendChild(newElement.cloneNode(true)).parentNode.innerHTML; } };