change spaces with hyphen code example
Example: replace all spaces with dash in javascript
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...