View Full Version : Replace ampersand with regular expression. Special Characters

04-27-2006, 03:21 PM
Hi, I would like to remove ampersands from text and repace them with the HTML special character.

This is so that I can use them in a query string.

This is my code but it doesn't work, can you see a problem with it?

//if have needed to escape the string for previous operations

content = textarea.value;
content = content.replace("&","&");

Thanks in advance


Philip M
04-27-2006, 04:04 PM
content = content.replace(/&/g,"&");