Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Verifying if the password field is empty
- <form id="form" method="post" action="student.jsp">
- <label><strong>Username :</strong><br/><br/>
- <input type="text" value="" name="username" id="idusername">
- </label><br/><br/>
- <label><strong>Password :</strong><br/><br/>
- <input type="text" value="" name="password" id="idpassword">
- </label><br/><br/><br/>
- <input id="minibutton" name="send" type="submit" value="Login" />
- </form>
- $(document).ready(function(){
- //global vars
- var form = $("#form");
- var username= $("#idusername");
- var password = $("idpassword");
- //On Submitting
- form.submit(function(){
- if(username.val().length==0 || password.val().length==0){
- alert('Please enter the username');
- return false;
- }
- else
- {
- if(password.val().length==0)
- {
- alert('Please enter the password');
- return false;
- }
- else
- return true;
- }
- });
- });
- var password = $("idpassword");
- var password = $("#idpassword");
- if(username.val().length==0 || password.val().length==0){
- alert('Please enter the username');
- return false;
- }
- else{
- if(password.val().length==0)
- {
- alert('Please enter the password');
- return false;
- }
- else
- return true;
- }
- if(username.val().length==0){
- alert('Please enter the username');
- return false;
- }
- if(password.val().length==0){
- alert('Please enter the password');
- return false;
- }
- return true;
Add Comment
Please, Sign In to add comment