我想自动关闭切换按钮,无论我选择什么产品都应该关闭。当点击时应该显示该产品。
HTML
<div class="heading" id="seamless" style="display: none;">
<center>PayPal now accepted! Make a sale and we'll email you to claim your funds. Easy!Your email: admin@example.com</center>
</div>
切换按钮
<div id="normal-toggle-button">
<input name="open" value="1" type="checkbox" onchange="checkshowhidereverse(this.status, '#seamless');checkshowhidereverse(this.status, '#setup');" checked="checked" />
</div>
Javascript
$(document).ready(function () {
//* toggle buttons
toggle_buttons.init();
});
Javascript 函数
//* toggle buttons
toggle_buttons = {
init: function () {
$('#normal-toggle-button').toggleButtons();
}
};
最佳答案
我不太确定我是否理解得很好?
最初 DIV 是隐藏的,未选中复选框?如果是的话这个怎么样
<div class="heading" id="seamless" style="display: none;">
<center>PayPal now accepted! Make a sale and we'll email you to claim your funds. Easy!Your email: admin@example.com</center>
</div>
<div id="normal-toggle-button">
<input id="checkBox" name="open" value="1" type="checkbox"/>
</div>
JS:
$('#checkBox').click(function() {
if( $(this).is(':checked')) {
$("#seamless").show();
} else {
$("#seamless").hide();
}
});
关于javascript - 如何自动关闭切换按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21549873/