Introduction

Validation through Javascript is used to provide security or better performance of code. First, we take aspx page to run validation through javascript. We take two Textbox, two Labels, and a button. Then we arrange them like the below figure.
validation through javascript
we write the following javascript code for validation
  1. <script type = "text/javascript">
  2. function validate()
  3. {
  4. var t = document.getElementById('TextBox1').value;
  5. if (t == "")
  6. {
  7. alert("Employ Id is Mandatory");
  8. }
  9. }
  10. </script>
Output: when we run this program there will be one message display if we leave blank column after click on the button.
output