Validate space in Java Script

by satheeshkumar 2014-08-05 12:17:32

Validate space in textbox or textarea using Java Script,
 
<script type="text/javascript">
function validateform()
{
    var mystring = document.getElementById('textbox_id').value; 
    if(!mystring.match(/S/))
    {
        //return false;
    }
    else
    {
       //return true;
    }     
}
</script>
 
HTML:
 
<input type="text" id="Name"  onblur="validateform()" />
The above function will return false when textbox box contains only  space..
1516
like
0
dislike
0
mail
flag

You must LOGIN to add comments