Reputation: 31
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();
}
});
Upvotes: 3
Views: 1474
Reputation: 17638
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
Upvotes: 1