【发布时间】:2014-04-02 23:17:17
【问题描述】:
$(document).ready(function() {
$('#bundlesubmit').click(function() {
if ($("#three").is(':checked')) {
$("#bundleDropDown1").toggle();
alert ('hey this is the three only one');
}
if ($("#two").is(':checked')) {
$("#bundleDropDown2").toggle();
alert ('hey this is the second one');
}
if ($("#two").is(':checked') == true && $("#three").is(':checked') == true) {
$("#bundleDropDown").toggle();
alert ('hey this is the two options');
}
});
});
所以我在整个互联网上搜索了答案,但找不到任何东西!该代码正在运行,但是当一个人选择两个复选框时,它会执行该功能并执行单个复选框的功能。
就像我选择#TWO 和#THREE 一样,它会执行所有功能。如何判断两者是否都被选中只执行一个功能。
【问题讨论】:
-
你的相关 HTML 结构是什么?