Answers for "javascript replace space with dash in field output"

7

javascript replace spaces with dashes

title = title.replace(/\s/g , "-");
Posted by: Guest on August-24-2020
3

js replace space with dash

// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');
Posted by: Guest on May-11-2021

Code answers related to "javascript replace space with dash in field output"

Code answers related to "Javascript"

Browse Popular Code Answers by Language