I have 3 field (fieldA, fieldB, fieldC) in my MVC4 application and I show/hide fieldB and fieldC according to the value of fieldA. Although there is no problem for show/hide these fields, I cannot prevent fieldB and fieldC to be validated when they hidden or disabled. I tried 3-4 different kind of methods i.e. using disabled, hidden property in showHideFields() method and "ignore" property in jQuery("#...").validate method. But none of them has worked properly yet. Could you please rovide such a kind of solution in order to do this?
Razor:
function showHideFields() {
    var $index = $('#fieldA').val();
    if ($index == '1') {           
        $('#fieldB').show(); 
        $('#fieldC').show(); 
    }
    else {
        $('#fieldB').hide(); 
        $('#fieldC').hide(); 
    }
}
jQuery(function () {
    jQuery("#fieldA").validate({
        expression: "if (VAL) {return true;} else {return false;}", 
        message: "Please fill in this field"
    });
    jQuery("#fieldB").validate({
        expression: "if (VAL) {return true;} else {return false;}",
        message: "Please fill in this field"
    });
    jQuery("#fieldC").validate({
        expression: "if (VAL) {return true;} else {return false;}",
        message: "Please fill in this field"
    });
    ...
}
 
     
     
    