Replace tag in html string with another
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<button type=button>Test</button>
<aside>
<h3>Some demo text here</h3>
</aside>
JavaScript
$('button').click(function() {
var code = '<aside><h3>Some demo text here</h3></aside>';
$(code).find('h3').replaceWith(function() {
return $('<div/>', {
html: this.innerHTML
});
});
});