UlompiHTML jQuery-laajennus - CSS-temppuja

Anonim

internalHTML () on natiivi ja palauttaa DOM-solmun sisällön (esim I live inside a div.. externalHTML () ei ole, mikä sisältäisi nykyisen DOM-solmun (esim. I live inside a div. ).

$.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))); )