My blog serves as a way for me to post solutions to problems I solve at work or during the long hours of freelance work.

JQuery Replace Globally

by Ezekiel 25. November 2012 04:55


Use /something/g.

var str = "This is sample text for a sample replace";
str = str.replace(/ /g, "-");

Tags: ,

Javascript | JQuery