Blank Space Validation using Javascript
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   kavitha_Rao
Posted On:   Wednesday, May 13, 2009 07:57 AM

I had written javascript code for blankspace validation in my form. it is not allowing blank space in text box. But i want to do like the first and last character sholud not space, In between space can allowed.. For that i used onkeyup=fun(); event in tag.. calling function. The function is function fun() { var name=document.getElementById('name').value; document.getElementById('name').value=name.replace(/[^A-Za-z]/g,''); It can work for not allowing blank space. but i want to modify as space is not allowed at first and last characters and in between allowed. Plz help me this. Please use html tags to format code blocks.    More>>

I had written javascript code for blankspace validation in my form. it is not allowing blank space in text box. But i want to do like the first and last character sholud not space, In between space can allowed..

For that i used onkeyup=fun(); event in tag.. calling function. The function is

function fun()
{
var name=document.getElementById('name').value;
document.getElementById('name').value=name.replace(/[^A-Za-z]/g,'');

It can work for not allowing blank space. but i want to modify as space is not allowed at first and last characters and in between allowed.
Plz help me this.


Please use html tags to format code blocks.

   <<Less

Re: Blank Space Validation using Javascript

Posted By:   Anonymous  
Posted On:   Tuesday, May 26, 2009 09:42 AM





Remove spaces.



















About | Sitemap | Contact