squiblo Posted April 15, 2010 Share Posted April 15, 2010 the following code only seems to replace the first "&" but any "&"s after that are not changed for example.... if var poststr = my name is bob & i live in england (this works) but... if var poststr= my name is bob & i live in england & i like pizza (this does not work) var replaceAND = "and38"; var message = poststr.replace("&", replaceAND); alert(message); Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 15, 2010 Share Posted April 15, 2010 poststr.replace(/&/g, replaceAND); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.