Print out jQuery object as HTML -
Is there a good way to print a jQuery object in the form of a net object?
ex:
& lt; Img src = "example.jpg" & gt; & Lt; Script & gt; Var img = $ ('img') Eq (0); Console.log (img.toString ()); & Lt; / Script & gt;
toString ()
does not work in this way I need HTML parallel string, that is:
& lt ; Img src = "example.jpg" & gt;
If you need to print the object in HTML format, then use this extension Or Update
Update
link and add another link's code:
$ .fn.outerHTML = Function () {// IE, Chrome & amp; Safari will comply with non-standard external HTML, all other (FF) returns (! This.length) will have to fall for cloning? It: (this [0] .other HTML || (function (L) {var div = document.createElement ('div'); div.appendChild (el.cloneNode (true)); var content = div.innerHTML; div = Null; return content;}) (this [0])); }
Comments
Post a Comment