Just escape the brackets to fix this: text.replace(/)/g, "right")
function myFunction() {
var text = document.getElementById("ansiText").value;
var finalText = text.replace(/)/g, "right");
document.getElementById("ansiText").value = finalText;
}
function myFunction() {
var text = document.getElementById("ansiText").value;
var finalText = text.replace(/)/g, "right");
document.getElementById("ansiText").value = finalText;
}
I want to find and replace (
as left
and )
as right
.
But its didn’t work if i write ) in code, its create errors. How can I write ( in replace function?