功能是:当选中其中一个复选框时,必须禁用另一个复选框。它的工作,但更新WordPress页面,并尝试编辑复选框后,我有以下问题: 用于禁用复选框不起作用的功能
首先我检查了显示摘录,然后更新的页面,你可以看到,有2这是检查
复选框”
<div><input type="checkbox" id="dx_article_excerpt" onclick="disableContentCheckbox()"><label for="dx_article_excerpt"><?php _e('Display Excerpt', 'dxeasypb'); ?></label></div>
<div><input type="checkbox" id="dx_article_content" onclick="disableExcerptCheckbox()"><label for="dx_article_content"><?php _e('Display Content', 'dxeasypb'); ?></label></div>
而且我这里还有功能框:
function disableContentCheckbox(){
if (document.getElementById('dx_article_excerpt').checked) {
document.getElementById("dx_article_content").disabled = true;
} else {
document.getElementById("dx_article_content").disabled = false;
}
}
function disableExcerptCheckbox(){
if (document.getElementById('dx_article_content').checked) {
document.getElementById("dx_article_excerpt").disabled = true;
} else {
document.getElementById("dx_article_excerpt").disabled = false;
}
}
为什么会发生这种情况?
为什么不使用单选按钮呢? – hRdCoder
你可以粘贴一个例子吗? –
复选框既可以选中也可以禁用。 – evolutionxbox