In order to replace all occurrences of a particular string or char, you can use the format below:
replace(//g, "");
Lets say there is a variable: var tag = ctl0_Parent:Child:Item;
var itm = tag.replace(":", "_");
will result with itm being equal to: ctl0_Parent_Child:Item
var itm = tag.replace(/:/g, "_");
on the other hand, will result in itm being equal to: ctl0_Parent_Child_Item
No comments:
Post a Comment