Javascript Introduction

  • Its client side scripting language.

  • We can do validations with the help of javascript.

  • Java script follows DOM.

  • This saves time for validations from server side.

  • We should not rely on javascript as this is written on html page and rendered to client side.



  1. Open notepad save file as index.html

  2. Add below code.


  3. Open file with any browser. you will see below

  4. The way in which we access data from textbox,same thing is applicable for list box and other input controls.

    1. Open notepad save file as index.html

    2. Add below code.


Here, we have accessed data from textbox into our function, so now we can easily validate this value as shown below.

Just modify the function as given below.


If textbox is empty and we click on Validate button then we will see an alert as below:

javascript alert message example