jQuery validation not working with that form

pramod

I have been trying to validate a form with jquery validate plugin.As a newbie i am facing problem with that.Here is the code

$(document).ready(function() {
  $("#log-form").validate({
    errorElement: 'div',
    rules: {
      "username": {
        required: true,
        minlength: 5
      },
      "password": {
        required: true,
        minlength: 5
      }
    },
    messages: {
      username: {
        required: "Provide a username,sire",
        minlength: "Username with length 5 atleast,is required"
      },
      password: {
        required: "Provide a password,sire",
        minlength: "Minimum length of 5 is required for password,sire"
      }
    }
    submitHandler: function(form) {
      form.submit();
    }
  });
});
<form name="log-form" id="log-form" method="post" action="check_login.php">
  <label for="username">Username</label>
  <input type="text" class="" id="username" name="username">
  <br>
  <label for="password">Password</label>
  <input type="password" class="" id="password" name="password">
  <br>
  <button type="submit" name="sub-btn" class="sub-btn">Login</button>>
</form>

The validation is not working as i change field after typing in one neither on submiting the form.

AmanVirdi

As per @unidentified: There is a syntax error in your code, missing , after the messages property. Please check How can I debug my JavaScript code?

$(document).ready(function() {
  $("#log-form").validate({
    errorElement: 'div',
    rules: {
      "username": {
        required: true,
        minlength: 5
      },
      "password": {
        required: true,
        minlength: 5
      }
    },
    messages: {
      username: {
        required: "Provide a username,sire",
        minlength: "Username with length 5 atleast,is required"
      },
      password: {
        required: "Provide a password,sire",
        minlength: "Minimum length of 5 is required for password,sire"
      }
    },                // syntax error, comma was missing here
    submitHandler: function(form) {
      form.submit();
    }
  });
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jQuery validation not working with that form

From Dev

Jquery: Form validation not working

From Dev

Jquery form validation not working?

From Dev

jQuery validation on form not working

From Dev

Jquery form validation not working?

From Dev

Form validation not working in jQuery

From Dev

jQuery form validation not working with bootstrap

From Dev

Form validation with Jquery not working with Chrome

From Dev

Form validation with Jquery not working with Chrome

From Dev

jQuery form validation not working with bootstrap

From Dev

jQuery validation is not working in contact form

From Dev

Jquery form validation is not working properly

From Dev

jQuery Validation From Dynamic Form Not Working

From Dev

Jquery form validation submit handler not working

From Dev

Ajax form submission with Jquery validation plugin is not working

From Dev

jQuery form validation default message replace not working

From Dev

jQuery Form Validation simple example not working

From Dev

jquery.steps and validation not working - form content not visible (invisible)

From Dev

jquery ajax form validation not working with GET method codeigniter

From Dev

ASP MVC jQuery validation onfocusout working, but not on form submit

From Dev

Form not submitting and jQuery validation not working unless submit button is clicked twice

From Dev

Form validation with JS not working

From Dev

Validation Form is not working

From Dev

Angular form validation is not working

From Dev

form validation not working as intended

From Dev

Validation not working on form

From Dev

CakePHP Form Validation Not Working

From Dev

form validation not working in angular

From Dev

Javascript form validation not working

Related Related

HotTag

Archive