Home > Uncategorized > Javascript trim

Javascript trim

This is your friend when you need to trim whitespace in javascript:

replace(/^\s*|\s*$/g,”)

Tags: ,
  1. April 2nd, 2008 at 17:37 | #1

    omg. sure, it /works/, but at what cost?

  1. No trackbacks yet.

Powered by WP Hashcash