If you call .html(myObj.html)
on a temporary element, you can do whatever you want, then read it back afterwards:
var myObj = {};
myObj.html="<span class="first">la-la-la</span><span class="second">la-la-la</span>";
$tmp = $("<div>").html(myObj.html);
$tmp.find(".second").remove();
myObj.html = $tmp.html();
console.log(myObj);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
1
solved How get HTML without remove child (jQuery) [closed]