Disable jquery validation plugin in hidden div

Basically I want to disable the jQuery "ketchup" validation plugin in the specified register form div.

This div is hidden by default and will only be shown if the switch is set.

The main problem is that I cannot provide the form information because validation is still active for the hidden div in the rest of the form.

This is an example of my code that puts a div in a hidden state, and now I want to turn off jQuery validation in it if the radio button is not checked, but keeping it for the rest of the form. And if the switch is set, validation will work for the whole form.

$("#escondido").css("display","none");

$("#element_30_2").change(function(){
    if ($(this).attr("checked") == true) {         
        $("#escondido").show();

    } else {

        $("#escondido").hide();
    }
});
+3
source share
1 answer

you just need to disable inputs

$("#element_30_2").change(function(){ if ($(this).attr("checked") == true) {
    $("#escondido").show().find('input').removeAttr('disabled');

} else {

    $("#escondido").hide().find('input').attr('disabled','disabled');

}

,

jQuery validation plugin, , - jQuery

+1

All Articles