Does jQuery have an equivalent of PHP's str_replace? I am needing to replace spaces in a text box with hyphens.
I googled and looked in the forum search but wasn't coming up with a good answer.
For more info see the W3C site on the replace() function.
To add to the above, you don't even need a regular expression:
str.replace(' ', '-');
var textarea = $('#the_textarea');
var txt = textarea.val();
textarea.val(txt.replace(' ', '-'));