JQuery validation with "button" type rather than "submit" type for a form

Viewed 31578

$('selector').validation() seems to be built more for the "input" type button than the "button" type. How would I get it working with a button type within the form?

@using(Html.BeginForm(new {id="TheForm"}))
{
     // code here
     <input id="TheButton" type="button">
}

JQuery:

$(document).ready(function() {
      $("#TheForm").validate({
            rules: {
                 "AuditDoc.Title": {
                       required: true
                  }
            }
      });
      $("#TheButton").click(function() {

      });
});

Using this basic idea, how would I get jquery validate working with a button rather than a submit type button? I've seen examples where JQuery automatically displays error messages when the rules aren't met using submit type, but it doesn't appear to work with button type. I'd appreciate any advice!

4 Answers
Related