I have the string R.E.M
. and I need to make it REM
So far, I have:
$('#request_artist').val().replace(".", "");
...but I get RE.M
.
Any ideas?
The first argument to replace()
is usually a regular expression.
Use the global modifier:
$('#request_artist').val().replace(/\./g, "");
replace() at MDC
You could pass a regular expression to the replace method and indicate that it should replace all occurrences like this: $('#request_artist').val().replace(/\./g, '');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With