I have a json in a textarea {"request":{"method":"GET","url":"/thing/1"},"response":{"status":200}}
I have a function currently which gets the value from my textarea and replaces
function setFontText(text) {
var str=document.getElementById("urls").value;
var res = str.replace(/"url":"/g, ""url":"" + text + """);
document.getElementById("urls").innerHTML=res;
}
I am currently replacing only "url:"/ however I would like to completely replace ( The Italicized section ) "url":"/thing/1" but the part in bold is dynamic here so I do not want to hardcode in my code like str.replace(/"url":"/thing/1"/g
Is there a workaround for this ? If the question isn't clear please revert
valueorinnerHTMLconsistently, not use one for getting the value but the other one for setting it.;on".)