SO - 21057311

by Arun P Johny

HTML

<div id="image">
  <img src="url" />
  <!-- Here some stuff. E.g. -->
  <div><p>Something</p></div>
</div>

JavaScript

var html1 = $('#image img').prop('outerHTML');
console.log('1', html1)

var html2 = $('#image img')[0].outerHTML;
console.log('2', html2)