Text Box Validate Script

Text box is a one type of graphical user interface element. Which is allows to give a text information for user.In this Text Box Validate Script is used to validate empty text box and character should be minimum length for a text box.

Demo :



Text box : 

Example :

Just click in validate button the java script alert will say 'Please Type Text for Text box'   then type text at text box if you like.

Code :

If you need to validate a text box following code helpful to you.you want to your web site copy and use it.


function validate()
{
  if(document.frm_text_box.text_box.value=='')
  {
    alert('Please Type Text for Text box');
    document.frm_text_box.text_box.focus();
    return false;
  }

  var text_value = document.frm_text_box.text_box.value;
  if(text_value.length >= 20)
  {
    alert('Please Type below for 20 letter');
    document.frm_text_box.text_box.focus();
    return false;
  }
}

In the above validate() function have using in two validate conditions for a text box. first one is a empty text box validate and second one is character should be minimum length.

Free Download Script:

If you need to Text Box Validate Script click and download from following zip file.

Download -->




Content