I have a bit of javascript
function hasSpaces(name)
{
if(name.search(/^\s*/) != -1){
alert(name);
name.replace((/^\s*/, "~"))
alert(name);
}
return name;
}
The name comes in like john smith and i have to turn it to john~smith, the alerts are just for testing. Sorry if this is the wrong forum but i need help and am terrible at javascript. It also has to replace all spaces in the name in case the name is john adams smith to john~adams~smith
thanks
Sean