我有一个单选按钮和复选框
<div class="counter_p" id="counter"></div>
我希望在选择这些按钮时收到通知
<input type='radio' name='testradiochange' id='testradiochange'> Testing Radio Change</input>
<input type='checkbox' name='acknowledge' id='acknowledge' value='acknowledge'></input>
以上在Chrome和Firefox中运行良好,但在Safari中则无效。任何的想法?
答案 0 :(得分:2)
您的代码中有很多拼写错误,以下是:
<div class="container">
<div class="item">
</div>
</div>
<div class="footer">
</div>
$("input[name=testradiochange]:radio").change(function () {
alert('radio selected');
}); // <= it was just }, i added ); to close the function's (
$("input[name=acknowledge]:checkbox").change(function () {
if ($(this).is(':checked')) { // if check
alert('checkbox selected');
} else { // if uncheck
alert('checkbox unselected');
}
}); // <= it was just }, i added ); to close the function's (