I want to find a string like link
and replace it with a <a href="#link">link</a>
.
Update: After the body is loaded.
I want to find a string like link
and replace it with a <a href="#link">link</a>
.
Update: After the body is loaded.
Your question was unclear for me. But the following should work
$( document ).ready(function() {
document.body.innerHTML = document.body.innerHTML.replace(/target string/g, "replacement string");
});
jQuery answer:
<p>link</p>
$('body').html($('body').html().replace('link', '<a href="#link">link</a>'));