My problem is that I want to have a small JS application that replaces all the text within a <textarea>
HTML tag. I made this small code but it only replaces the first entry:
When I click the button the unicode \u0066 which stands for "f" gets replace but when I have multiple of those like this \u0066 \u0066 \u0066 then it only replaces the first entry and as soon as I click on the button a second time it replaces it the second \u0066 and so on.
Question: Is there a way to apply this method for every character in one button press?
function decodeText() {
let input = document.getElementById("textInput").value;
let r1 = input.replace('\\u0066', 'f');
document.getElementById("textInput").value = r1;
}
<textarea id="textInput"></textarea>
<button onClick="decodeText()">Decode</button>