SyntaxFix
Write A Post
Hire A Developer
Questions
takes care of multiple white spaces and replaces it for a single character
myString.replace(/\s+/g, "-")
http://jsfiddle.net/aC5ZW/340/