how to remove any character using javascript?

I am removing only ” – (dash), . (dot), (space) in this exmple.

function dotrm(cit)
{
var cl=cit.length;
var ch=cit;
for(l=0;l<=cl;l++)
{
if(cit[l] == ‘.’ || cit[l] == ‘ ‘ || cit[l]==’-‘)
{
ch=cit.replace(cit[l],”);
}
}
document.getElementById(“city”).value=ch;
}


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *