I'm using jQuery Validation Plugin - v1.11.1 and jquery 1.10.2 but below code doesn't work in IE 8. It works fine in IE9 and above and also in other browsers like Chrome.
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script src="Scripts/jquery_validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#btn').click(function() {
$("#form1").validate({
rules: {
<%= txt.UniqueID %>: "required"
},
messages: {
<%= txt.UniqueID %>: "Please enter QTY"
}
});
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
ID
<asp:TextBox runat="server" ID="txt" ClientIDMode="Static" />
<asp:Button Text="Test" runat="server" ID="btn" ClientIDMode="Static" />
</asp:Content>
EDITED:
The reason I wrapped the validate() within $('#brn').Click(function(){}) event is that I have another postBack from GridView RowCommand Event.Is there another way to call jquery validate() only when the button is clicked?