4 回答

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超13個(gè)贊
這是簡短而簡單的。
$('input[type=checkbox]').on('click', function() { $('#MainContent_txtSrchToDate').prop('disabled', $(this).is(":checked")); });

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊
試試這個(gè):
$('input[type=checkbox]').click(function() {
let dateElements = $("#MainContent_txtSrchFromDate, #MainContent_txtSrchToDate");
if ($(this).is(":checked")) {
dateElements.prop("readonly", true);
} else {
dateElements.prop("readonly", false);
}
});

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊
要檢查一個(gè)復(fù)選框是否被選中,你可以簡單地這樣做:
$('#chkShowAll').checked
如果選中則返回 true 否則返回 false

TA貢獻(xiàn)1878條經(jīng)驗(yàn) 獲得超4個(gè)贊
if($("#checkbox_id").is(':checked')){
console.log("checked");
}
else{
console.log("not checked");
}
此顯示復(fù)選框是否選中
添加回答
舉報(bào)