javascript - How to replace all occurring same character like ' with ;$39 -
i using following code, in want replace ' ;$39 not working fine . it's replace first ' .
var searchusername = document.getelementbyid("ctl00_contentmain_usersearchcoll").value.replace("/\'/g", ";$39;");
for example: ram's's .output: ram;$39s;$39s
thanks in advance.
you don't need put regexp inside double quotes. remove them.
value.replace(/'/g, ';$39;')
also note need not "escape" single quote. (thanks @paul s. pointing)
Comments
Post a Comment