I have this piece of code
widgetId = "a.b";
func= function(widgetId, tableId, primaryColSearchKey)
{
widgetId = test(widgetId);
}
test= function(id)
{
id = id.replace(/\./g, "\\.").replace(/ /g, "\\ ").replace(/\(/g, "\\(").replace(/\)/g, "\\)");
return id.replace(/\ /g, "\\ ");
}
If I call it in my program it returns a\\.b
, but if I run it w3schools website it returns a\.b
in IE browser.
Can somebody explain why, as I want it to return a\.b
in my code.