Posts

Showing posts from November, 2017

Remove form validation rule on click event of Specific Button

Remove form validation rule on click event of Specific Button Apply or Remove rules on the Button when click event occurs. $( '#btnSubmit’).on(' click ', function(){     $( '[name="Postcode"]' ).rules ( 'add' , {         required: true ,         email: true     });     $( '#County).rules(' remove ');            $( '#personal-details-form' ). valid (); // Trigger the validation & do NOT submit        }); And also, when you use other button, while using Click event, remove rules applied on  #btnSubmit’ click . Just in your case if you want to Invalidate  Surname  if you have set using other buttons, use  $('[name="Surname"]').rules('remove'); $('[name="FirstName"]').rules('remove'); Example: $(document).ready( function (...