JSFiddle - React, Tailwind, and code Playground
HTML
<p>link some other text</p>
<button>Replace Me</button>
JavaScript
$('button').on('click', function() {
$('body').html($('body').html().replace('link', '<a href="#link">link</a>'));
});
<p>link some other text</p>
<button>Replace Me</button>
$('button').on('click', function() {
$('body').html($('body').html().replace('link', '<a href="#link">link</a>'));
});