JSFiddle - React, Tailwind, and code Playground
by theacadian
HTML
<!DOCTYPE html>
<html>
<body>
<p>Click the button to replace "Microsoft" with "W3Schools" in the paragraph below:</p>
<p id="demo">Visit Microsoft! because Microsoft rocks!</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var str=document.getElementById("demo").innerHTML;
//var n=str.replace("Microsoft","<img src='dgdfd'>Microsoft");
var n=str.replace(/Microsoft/g,"<img src='dgdfd'>Microsoft");
document.getElementById("demo").innerHTML=n;
}
</script>
</body>
</html>