I’ve seen a lot of work-arounds for doing outerHTML() in jQuery. outerHTML() is not part of the spec and therefor is not supported across all browsers. Browsers like Firefox do not support outerHTML. Here is a cross-browser solution that you can use in a jQuery-style kind-of way.

The updated gist can be found here.

/* 
 * Full example here: http://jsfiddle.net/jboesch26/3SKsL/1/
 */
 
$.fn.outerHTML = function(){
 
    // IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning
    return (!this.length) ? this : (this[0].outerHTML || (
      function(el){
          var div = document.createElement('div');
          div.appendChild(el.cloneNode(true));
          var contents = div.innerHTML;
          div = null;
          return contents;
    })(this[0]));
 
}

Now call it like so, $(‘#myid’).outerHTML();