I using jquery.validate to validate my asp.net page. but when i got use submit, i got a perfect validate style like pic1
but i need use button to save my data with ajax,so i try another way,like this
$(function() {
$("#btns").click(function() {
if ($('#form1').valid()) {
}
});
});
the script was well work,but the high line of inoput was disappear and the result like this pic
i want to use button onclick function to trigger jquery validate , and use the first error style, how can i do? thx all
Sample Code like that.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script src="../JS/jquery.js" type="text/javascript"></script>
<script src="../JS/jquery.validate.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(function() {
$("#btns").click(function() {
if ($('#form1').valid()) {
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="tbxEmail" type="email" name="email"></asp:TextBox>
<input id="cemail" type="email" name="email" required />
<input class="submit" type="submit" value="Submit"/>
<input type="button" id="btns" value="btn"/>
</div>
</form>
</body>
</html>