JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<a href="http://stackoverflow.com">Stackoverflow</a><br/>
<a href="http://superuser.com">Superuser</a>
</p>
<button>Replace</button>
JavaScript
$('button').click(function() {
$('p a').replaceWith(function() {
return $(this).attr('href');
});
});