Ady Wicaksono Daily Activities

verify blank string on form with javascript

leave a comment »

Here’s the function

function isSpaceOnly(s){
var l = s.length;
var c; for(i = 0; i < l; i++){
   if(s.charAt(i) != ' ' && s.charAt(i) != '\t' && s.charAt(i) != '\n'){
      return false;
   }
 }
 return true;
}

Then you only need to use if that function return true -> meaning blank string including space only string given

Written by adywicaksono

October 31, 2007 at 2:18 pm

Posted in javascript

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: