Javascript remove spaces

9 September 2005 9:14

It’s a trivial thing which is quite often needed in Javascript, a quick easy way to remove spaces. Regex is the answer.

Sure you’ve seen something similar before but useful for reference non the less. Can be used against any string but this example is used on a form input box.

<input type=“text” name“bob” onBlur=“this.value = this.value.replace(/s*/g,’);”>

Filed: Technology

You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a comment or leave a trackback from your own site.

Leave a Reply

 
What's ianteresting?   •   Twitter   •   About   •   Contact
©2012 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset