I can't, for the life of me, figure out how to replace all [
with <
and all ]
with >
in a value in JavaScript.
Here's what I've tried and it just doesn't work:
function SwitchDialog(NextDialog)
{
if (NextDialog=='SCHEDULE') {
$('.popup1').smart_modal_hide();
} else if (NextDialog=='LICENSEE') {
gotoLicensee(licenseeLink);
} else if (NextDialog=='REVIEWCART') {
window.location = CART_URL;
} else if (NextDialog=='RFO') {
window.location = REGISTER_FOR_OTHERS_URL;
} else {
if (NextDialog=='PREREG') {
var msgtxt = gk_text.replace(//[/g, '<');
msgtxt = msgtxt.replace(//]/g, '>');
DialogTemps[NextDialog].msgtext = msgtxt; // error occurs on this line
}
RenderDialog(NextDialog);
}
}
I get a Syntax error: "missing ) after argument list
at the ; on the line that assigns the msgtext
.
What the heck am I doing wrong?