I have form and I am using jQuery's validation. It's a test demo.
<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.ClientID %>").valid()) {
ajaxFunc();//ajax funcion to add email to db
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<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>
When I use Subimit, the cemail input validate working well(it is showing the validate message and high line the input order).
But when I use button click - doesn't show something. How can I get the same effect when I use button onclick function? Thank you for your help!