我試圖讓這些單選按鈕在瀏覽器中可點擊。我在link here處找到了一個例子,但是相同的實現在我的瀏覽器中不起作用,在這裏也不在這個片段中。變黑時變色,變黑時再變黑,但不會保留該信息或顯示覆選標記,就像在我發現的示例中那樣。風格的引導程序單選按鈕不能在瀏覽器中點擊
這裏缺少什麼?
.btn span.glyphicon {
opacity: 0;
}
.btn.active span.glyphicon {
opacity: 1;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="well well-sm text-center">
<h3>Radio</h3>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-success" for="option1" active">
<input type="radio" name="options" id="option1" autocomplete="off" chacked>
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-primary" for="option2">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-info" for="option3">
<input type="radio" name="options" id="option3" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default" for="option4">
<input type="radio" name="options" id="option4" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-warning" for="option5">
<input type="radio" name="options" id="option5" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-danger" for="option6">
<input type="radio" name="options" id="option6" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
</div>
</div>
</div>
他說謊,他已經用jQuery來的'active'類添加到'label'標籤!從技術上講,他使用** bootstrap.js **中的'data-toggle =「button」',你可以在[Boostrap文檔]上檢查它(http://getbootstrap.com/javascript/#buttons-checkbox-radio) –