Jon wrote:
Quote:
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
textarea.value=unescape(textarea.value);
content = textarea.value;
content = content.replace("&","&"); |
Have you tried quoting the ampersand (which is also an SGML special
character)?:
content = content.replace("&","&");
Also, are you sure you're using the "content" variable afterward properly?