Wednesday, October 31, 2012

JQuery Validation Plugin: validate onclick


$('#link').click(function() 
   { 
      // call .valid() method for each field
      if ($("input[name=name]").valid() && $("input[name=email]").valid()) 
      { 
         // do some stuff 
      } 
      else 
      { 
         // just show validation errors, dont post 
      } 
   });

Reference:
http://stackoverflow.com/questions/9129029/jquery-validation-onclick

No comments: