Possible Duplicate:
JavaScript equivalent to printf/string.format
replace all occurrences in a string
see title. see the following variable, how can i replace all '%s' with other string?
var s = 'qwer%sqwer%s';
please advice
Possible Duplicate:
JavaScript equivalent to printf/string.format
replace all occurrences in a string
see title. see the following variable, how can i replace all '%s' with other string?
var s = 'qwer%sqwer%s';
please advice
Use .replace
method.
var s = 'qwer%sqwer%s';
s = s.replace(/%s/g, 'other');
You can Use replace() function for replacing string Ex.
var getnewstring = s.replace("%s","YOUR STRING");
Use the .replace method
var s = 'qwer%sqwer%s';
s=s.replace('%s','your string')
document.write(s);