3

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

This div is hidden by default, and will only appear if a radio button is checked.

The main problem is that i can't submit the information of the form, because the validation is still active for the hidden div in the rest of the form.

This is an example of my code that puts the div hidden, and now i want to disable the jQuery validation in it if the radio button is not checked, but maintaining it for the rest of the form. And if the radio button is checked the validation will work for the entire form.

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

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

    } else {

        $("#escondido").hide();
    }
});
2

1 Answer 1

1

you just need to disable the 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');

}

this also means that the values will not be submitted

as a side note i support the use of jQuery validation plugin i am not associated with them just know its a good product and was developed by someone on the jQuery team

Sign up to request clarification or add additional context in comments.

1 Comment

It doesn't work. The validation is still active in the hidden div if the radio button is not checked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.