Friday, 9 December 2011

Java Script for not allow 'Space'

function nameoffun()
{
    var name = document.getElementById('inputboxid').value;
    var pattern = /^[a-zA-Z0-9]+$/;  //it  allow only alphanumeric characters, not allow space  b/w them..  
     if(pattern.test(name))
           return true;
    else
          return false;
  }

No comments:

Post a Comment