I have a JavaScript function that replaces a space with a +
sign. However, a literal +
is passed as the parameter in the url and I need it to be convert to %2B
. I tried in my JavaScript function to replace the space into %2B
but it ends up converting it back to a plus sign in the URL.
function replacespace() { var p = document.getElementById('keywords') p.value = p.value.replace(/\s+/g, encodeURIComponent('+')); }
Any ideas on how to force the url to use %2B
instead?