我有一个带有以下代码的 boostrap 切换。它在视觉上工作正常
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="showBuildQuantity" autocomplete="off" checked>Build Quantity
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="showNumberOfScreens" autocomplete="off" onclick="showBuildQuantity()">Number of Screens
</label>
</div>
在它下面我有一些代码来处理点击事件:
$(document).ready(function () {
$('#showBuildQuantity').on('click', function () {
<code here>
});
$('#showNumberOfScreens').on('click', function () {
<code here>
});
});
我遇到的问题是,当我单击切换按钮时,单击事件永远不会运行。
我在同一页面上有其他按钮使用相同类型的 jQuery 单击事件,它们没有问题。