I'm trying to get the HTML form of some objects(including text), using jquery contents. Here's what I got until now:
HTML
<div id="mydiv">
test
<p>foo</p>
<p>bar</p>
</div>
jQuery
$('#mydiv').contents().each(function(){
console.log($(this).html());
console.log($(this).prop("innerHTML"));
console.log($(this).prop("outerHTML"));
});
Is there any way to do this? I've searched around but I couldn't find anything.
Thank you in advance for the answer!