Я хочу отключить или включить 6 выпадающих списков с 6 флажком. я сделал это на моем пути по 6 функции, но хочу только 1 функцию для этого. это можно сделать?отключить различную выпадающую базу на разных идентификаторах
Это скриншот моего html и ниже - мой код. enter image description here
$('#check_policy1').click(function(){
if($('#check_policy1').is(':checked')){
$(this).closest('.row').children('div:nth-child(3)').children('div').children('select.a').removeAttr('disabled');
}
else {
$(this).closest('.row').children('div:nth-child(3)').children('div').children('select.a').attr('disabled', 'disabled');
}
});
$('#check_policy2').click(function(){
if($('#check_policy2').is(':checked')){
$(this).closest('.row').children('div:nth-child(3)').children('div').children('select.a').removeAttr('disabled');
}
else {
$(this).closest('.row').children('div:nth-child(3)').children('div').children('select.a').attr('disabled', 'disabled');
}
});
, пожалуйста, отформатируйте размещенный код. –