"Radio - CSS/js"
Bootstrap 3.2.0 Snippet by inge1980

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <h1 class="text-center">Radio - CSS/js</h1> </div> <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 active"> <input type="radio" name="options" id="option1" autocomplete="off" checked> <span class="glyphicon glyphicon-ok"></span> </label> <label class="btn btn-danger"> <input type="radio" name="options" id="option2" autocomplete="off"> <span class="glyphicon glyphicon-remove"></span> </label> </div> </div> </div>
.btn span.glyphicon { opacity: 0; } .btn.active span.glyphicon { opacity: 1; }
$('.btn-success>input').click(function() { alert('test'); $('input[type="radio"][name="options"]').not(':checked').prop("checked", true); });

Related: See More


Questions / Comments: