There are 2 radio buttons #is_group_1 and #is_group_0 . When selecting #is_group_1 , the select #product_select must be removed from the #product_select attribute. And when selecting #is_group_0 , the disabled #product_select must be added to the #product_select attribute. The code works in one direction for some reason.
var productType = $('#is_group_1'); var productSelect = $('#product_select'); productType.change(function(e) { e.preventDefault(); productSelect.prop('disabled', true); }, function() { productSelect.prop('disabled', false); }); I tried it this way, but it doesn't work that way either.
var productType = $('#is_group_1'); var productSelect = $('#product_select'); if(productType.attr('checked') == 1) { productSelect.prop('disabled', false); } else { productSelect.prop('disabled', true); }
changefunction takes only one parameter - Grundy