$(function() { $('#content #selectbox').attr('disabled', 'disabled'); }); $('#switchEnabled').change(function() { if ($(this).prop('checked')) { $('#content #selectbox').removeAttr('disabled'); } else { $('#content #selectbox').attr('disabled', 'disabled'); } });
<h1>jQuery</h1> <div id="content"> <label> <input type="checkbox" id="switchEnabled"> enabled </input> </label> <select id="selectbox"> <option>a</option> <option>b</option> <option>c</option> </select> </div>