我正在檢查複選框是否已選中,並在頁面上顯示一個元素(如果已選中)。如何檢查是否與更改監聽器一起檢查複選框
這是我的函數:
function checkedTechSolutions(){
Y.one('#techsol input[type=checkbox]').on('change', function (e) {
var target = e.currentTarget,
techSBox = Y.one('#techsolutions');
if (target.get('checked')){
techSBox.show();
} else techSBox.hide();
}
}
這是我的CSS:
#techsolutions {width: 380px; height: 100px; background-color:#cee4f2; display: none;}
#techsolutions .box {text-align: center;}
這是我的html:
<div id="techsolutions">
<div class=box>
<label for="TypeOfTS">Tech Solutions: </label>
<select name="techSolutionsDrop">
<option value="techServices">Choose your services </option>
</select>
</div>
</div>
看看完整的解決方案,如果你發佈的鏈接代碼jsfiddle.net –