如何在jsp中禁用页面加载时选择的选择框,然后如何在jQuery中单击按钮时启用所选的选择框? 在我的代码下面。
<select disabled="disabled" class="chzn-select chosen-select-deselect chzn-select-width" style="width: 100px" id="workweekmonday" name="workweekmonday" >
<option value="0" selected="selected">Full Day</option>
<option value="4">Half Day</option>
<option value="8">Non-working Day</option>
</select>
<div class="col-md-2 col-md-offset-3">
<button type="button" class="btn btn-theme02 btn-block" id="btnsaveworkweek">
<i class="fa fa-save"></i> Edit
</button>
</div>
答案 0 :(得分:0)
$(document).ready(function(){
$("select").chosen();
$("#workweekmonday").prop('disabled', 'disabled'); //On load disabled select
$("#btnsaveworkweek").click(function(){
$("#workweekmonday").prop('disabled', false); //On button click enabled select
});
});
<强> JS Fiddle 强>
答案 1 :(得分:0)
试试这个:
$("#btnsaveworkweek").click(function(){
$("#workweekmonday").removeProp('disabled');
});