replace space with dash JavaScript

var html = "<div>"+title+"<br/>";
document.write(title.replace(/ /g,"-"));
html+= '<p><a href="go.aspx?title=' + title + '">Details<\/a></p></div>';

I want to replace title space with dash.

Leave a Comment