I have a return data string from an Oracle process that outputs [TD]
and [/TD]
rather than <TD>
and </TD>
to denote an html table cell. I need to translate [TD]
to <TD>
and [/TD]
to <TD>
in an element with an ID of unchangedValues using Javascript.
I've Googled and searched on here and this is the closest I've got so far, neither of which work. Any help here would be most gratefully received.
function strReplace() {
var string = document.getElementById('unchangedValues').innerHTML;
var res1 = string.replace(/(\[)|(\])/g, function(match, p1, p2) {
if (p1) return "<";
if (p2) return ">"
});
}
and I've also tried:
function substituteValues() {
const str = document.getElementById('unchangedValues').innerHTML;
const res1 = str.replace(/\[TD\]/g, '\<TD\>');
document.getElementById('unchangedValues').innerHTML = res1;
}
Thanks