regex jquery remove all double spaces
- by michael
Hi I have this code, I want it to remove all the double spaces from a text area, but it will only remove the first occurrence each time.
$(document).ready(function(){
$("#article").blur(function(){
///alert($(this).val());
$(this).val($(this).val().replace(/\s\s+/, ' '));
});
});
I've also tried removeAll(), but it won't work at all. any help would be great, thanks.
I have a live example online at http://jsbin.com/ogasu/2/edit