how to replace space with dash in jquery code example
Example 1: replace all spaces with dash in javascript
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...
Example 2: js replace space with dash
// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');