The only way to toggle rules dynamically is through the .rules('add')
and .rules('remove')
methods provided by the plugin.
Since you didn't show code, I can only show generic examples:
Remove required
rule from the input
with name="myfield"
…
$('input[name="myfield"]').rules('remove', 'required');
Remove required
rule from all input
elements that are type="text"
. Multiple elements require the .each()
method…
$('input[type="text"]').each(function() {
$(this).rules('remove', 'required');
});
Adding rules dynamically is a similar process.
$('input[name="myfield"]').rules('add', {
required: true
});