How can I replace text on a page using jQuery without replacing tags and text within tags such as: <a>,<input>,<button>,<textarea>,<input>,<select>.
For example, here is the HTML code
<html>
<head>
<title>Testing</title>
</head>
<body>
Hello, this is a test replacing {REPLACE_ME} with <b>{REPLACED}</b>.
<br/><br/>
I want {REPLACE_ME} and {REPLACE_ME} to be <b>{REPLACED}</b>, however I don't want this <a href="#">{REPLACE_ME}</a> to become <a href="#">{REPLACED}</a>.
Same with <textarea>{REPLACE_ME}</textarea>, it shouldn't change.
<br/><br/>
</body>
I have this jQuery to replace the text
var replaced = $("body").html().replace(/{REPLACE_ME}/gi,'<b>{REPLACED}</b>');
$("body").html(replaced);
Here it is on JSFiddle
inputtwice.