I am using jquery to parse some HTML, something like:
$(html).contents().each(function(){
var element = this.tagName;
...
I can access tagName, children, parent ... using the DOM or more friendly jQuery functions.
But at some point all the HTML of the current element is needed (not something that is returned innerHTMLeither .html()), and I cannot find one liner to get it (I could always attach the tag and attributes manually for innerHTML).
For instance:
<a href="link">Link</a>
innerHTML- Linkbut I'm looking for everything<a href="link">Link</a>
Does this oneliner exist?
source
share