3 回答
TA贡献1783条经验 获得超4个赞
我准备了一个简单的解决方案,当您单击复选框时,仅使用 CSS 来显示按钮。我希望这可以帮助你
<label for="id_10139347"> CHECK BOX </label>
<input class="suscriptionCheck" id="id_10139347" type="checkbox" name="id_10139347">
<br/>
<button>SOME BUTTON</button>
button {
display: none;
}
.suscriptionCheck:checked ~ button{
display:block;
padding: 14px;
}
https://codepen.io/r0binxp/pen/poygbXr
TA贡献1818条经验 获得超3个赞
也许这会对你有所帮助。也有很多相同的问题得到了回答。
$("#id_10139347").change(function() {
if(this.checked) {
//Do stuff
}
});
TA贡献1824条经验 获得超6个赞
您可以执行以下操作:
function displayButton(item) {
if (item.checked == true) {
document.getElementById("button").style.display = "block";
} else {
document.getElementById("button").style.display = "none";
}
}
#button {
display: none;
}
<input id="id_10139347" type="checkbox" name="id_10139347" onclick="displayButton(this)">
<button id="button">Submit</button>
displayButton()
单击输入框时会触发该函数。如果选中输入,则显示按钮。否则不显示。
添加回答
举报