Using JavaScript we can perform client side validation. It will improve the performance of your web application. Here i have shown a simple basic validation, how to check whether a text box has value or not.
Here the alert is used to display a message box with the text it has. And the focus() is used to move the cursor to the corresponding text box.
var username=document.getElementById("uname").value; if (username==null || username=="") { alert("Please Enter Username"); document.getElementById("uname").focus(); }
Here the alert is used to display a message box with the text it has. And the focus() is used to move the cursor to the corresponding text box.
No comments:
Post a Comment