Possible Duplicate:
jQuery / Javascript replace <space> in anchor link with %20
I am getting sParameter like this :
sParameter = document.getElementById('ddParameterType').value;
If I am getting word like "Test - Text" as the ddParameterType item, then I am replacing the space in word like below:
sParameter = document.getElementById('ddParameterType').value.replace("","%20");
but it is returning a valur like %20Test - Text.
I need like Test%20-%20Text.
the
.trimwill remove leading and trailing whitespace from the string.encodeURIComponentwill URL-encode it.