jquery validation for specific button onclick
i am using jquery client side validation in asp.net.
the problem i a开发者_JS百科m facing now is that whenever i click any button in a page it causes validation rather than for specific button alone.
how to resolve this .?
thank you
Suppose you have two buttons SubmitButton and CancelButton and you do not want to CancelButton to fire validation plugin, just give CssClass="cancel" for CancelButton
<asp:Button ID="CancelButton" runat="server"
Text="Return to List"
CssClass="cancel" />
You want to use event.preventDefault()
.
http://api.jquery.com/event.preventDefault/
$("button").click(function(event) {
event.preventDefault();
// do stuff here
});
精彩评论