JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#nogo" class="test">test</a><br />
<a href="#nogo" class="test">test 2</a>

JavaScript

var replace = "<p>new content</p>";
$(".test").each(function(){
   this.outerHTML = replace;
});