2
我试图做一个引导BTN-组不可选择通过点击下面的代码从先前所选择按钮:如何在Bootstrap btn-group中取消选择单击按钮?
$(document).ready(function() {
$('label.btn').click(function(e) {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div id="note_reactivity" class="btn-group notes" data-toggle="buttons">
<label id="1" class="btn btn-primary">
<input type="radio">1
</label>
<label id="2" class="btn btn-primary">
<input type="radio">2
</label>
<label id="3" class="btn btn-primary">
<input type="radio">3
</label>
<label id="4" class="btn btn-primary">
<input type="radio">4
</label>
</div>
“激活”类似乎是我的代码上去除点击事件,但它刚刚重新出现。 你知道该怎么做吗?
非常感谢你它的工作! – Vincent
没问题,很乐意帮忙。 –
也为我工作。这让我非常高兴和非常难过,因为这很难。 :-) – moodboom