<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..