...

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



jwhittlestone
04-27-2006, 02: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

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

Thanks in advance

Jon

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum