You need to use a regular expression, so that you can specify the global (g) flag:
var s="some+multi+word+string".replace(/\+/g, ' ');
(I removed the $()
around the string, as replace
is not a jQuery method, so that won’t work at all.)
More Related Contents:
- jQuery Adding new option to select element doesn't pick up the string [closed]
- Find a string of text in an element and wrap some span tags round it
- Select which href ends with some string
- Remove whitespace and line breaks between HTML elements using jQuery
- jQuery if div contains this text, replace that part of the text
- Insert space before capital letters
- Remove all HTMLtags in a string (with the jquery text() function)
- Get the current jQuery selector string?
- JavaScript – Escape double quotes
- jQuery remove tag from HTML String without RegEx
- Prevent users from submitting a form by hitting Enter
- Using .text() to retrieve only text not nested in child tags
- jQuery.ajax() method’s async option deprecated, what now?
- How to define multiple CSS attributes in jQuery?
- how to access the $(this) inside ajax success callback function
- resize font to fit in a div (on one line)
- Why does JQuery have dollar signs everywhere?
- Difference between .success() and .complete()?
- iPad/iPhone hover problem causes the user to double click a link
- Typewriter Effect with jQuery
- jquery mousewheel: detecting when the wheel stops?
- jQuery: there is a way to apply colour (tint) to an image?
- how can I use data posted from ajax in flask?
- jquery – keep window from changing scroll position while prepending items to a list?
- Ajax Form submit with preventDefault
- How to cancel a jquery.load()?
- Does Twitter Bootstrap include jQuery?
- submit disabled fields
- access model in javascript asp .net mvc razor
- jQuery – Detecting if a file has been selected in the file input [duplicate]