try like,
modfiy as per your needs..
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery.js.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
$(function () {
var iswrongcredential = $('#hdnCheck').val() == 'wrong';
if (iswrongcredential) {
$('#txtUserName ,#txtPassword').effect('shake');
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
UserName:
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><br />
Password:<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
<asp:HiddenField ID="hdnCheck" runat="server" />
</form>
</body>
</html>
code behind file:
protected void btnLogin_Click(object sender, EventArgs e)
{
if (txtUserName.Text == "username" && txtPassword.Text == "password")
{
hdnCheck.Value = "correct";
}
else
{
hdnCheck.Value = "wrong";
}
}