I'm trying to modify HTML string by converting it to jQuery object, and then back to a string, but I'm losing somehow the parent element:
var code = '<div><img src="" /></div>';
var html = $(code);
console.log(html.html());
Output:
<img src="">
Instead of expected:
<div><img src=""></div>
How to get all elements back?