[Solved] shake a textbox if validation fails using jquery


You need to use JQuery-UI to get the shake effect. Below is an example of it:

$(document).ready(function() {
  $("#login_button").click(function() {
    if ($("#password1").val() != $("#password2").val())
      $("#login").effect("shake");
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<form id="login" name="login">
  <h3>Login Form</h3>
  <input class="password" id="password1" name="password" placeholder="Password" type="password">
  <input class="textbox" id="password2" name="password" placeholder="Password" type="password">
  <input id="login_button" type="button" value=" Login ">
</form>

solved shake a textbox if validation fails using jquery