[thelist] [JS] Truly checking for empty fields
Stephen Rider
evolt_org at striderweb.com
Thu Apr 15 09:56:13 CDT 2004
Okay, but doesn't deleting all spaces jam words together?
I would think that trimming the value would be the better solution.
Steve
On Apr 9, 2004, at 12:23 PM, Edwin Horneij wrote:
> This deletes all space characters from a form field's value and checks
> to see if the resulting string is empty. I think I got it's from the
> O'Reilly JS mega-ref.
>
> if ( myform.myfield.value.replace( /\s/g, '' ) == '' ) {
> ...
> return false;
> }
More information about the thelist
mailing list