Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


ignore space in javascript



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
sundarraj_mca



Joined: 14 May 2008
Posts: 19

PostPosted: Fri Jun 20, 2008 9:10 am    Post subject: ignore space in javascript Reply with quote

hai

how to ignore space in text input

i have a textbox for Demand Draft no in which only 6 characters are allowed my script accepts 6 numeric correctly but it also accepts space. i need validate it.
Back to top
View user's profile Send private message Send e-mail
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 627
Location: Cebu City Philippines

PostPosted: Fri Jun 20, 2008 10:29 am    Post subject: Re: ignore space in javascript Reply with quote

You could either use indexOf() method.
Code:

if(!(txt.indexOf('')==-1))
   {
   alert('There\'s a space');
   }

...or match() method.
Code:

str.match(/^[\d]{6}$/)


Hope it helps.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap