Friday, May 8, 2015

javascript replace string :


if you want to replace only first occurance of item then use :

item.replace("item you want to replace ", "item you want to replace with");

or if you want to change all then :

item.replace(new RegExp("item you want to replace", "g"), 'item you want to replace with');

No comments:

Post a Comment