javascript - Get HTML String for jQuery and/or DOM object -
i think i've read through complete jquery api documentation , looked @ jquery objects , simple dom elements in debugger check methods have @ runtime, life of me, can't find way html string represents contents of jquery object or dom node. missing something?
jquery objects have method html()
, dom elements have property innerhtml
both give inner html of object. if have html this:
<body> <div> <p>hello world!</p> </div> </body>
and use jquery doing var $div = $body.find("div")
, call $div.html()
returned string "<p>hello world!</p>"
. i'm looking way make return "<div><p>hello world!</p></div>"
(i don't care whitespace).
what doing wrong? can't difficult html representation of these objects, can it?
try dom property .outerhtml
Comments
Post a Comment