full HTML of object returned by jQuery selector
I'm not sure if this works, but it might be worth a shot:
var html = $('#the_list_item')[0].outerHTML;
alert(html);
var html = $('#the_list_item')[0].outerHTML;
console.log(html);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul>
<li id="the_list_item"><img src="some_img"></li>
</ul>
One way is to create your own wrapper:
$("#the_list_item").wrap('<div>').parent().html();
...do your thing, then unwrap:
$("#the_list_item").unwrap();
Leaving just in case someone nowadays is still looking for this.
Full jQuery solution:
$('#the_list_item').prop('outerHTML');