"Image Checkbox Buttons"
Bootstrap 3.0.3 Snippet by ccela

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <br /> <div class="container"> <div class="row"> <div class="col-md-12"> <form class="form-horizontal well" role="form"> <div class="row"> <div class="col-xs-3"> <img src="http://www.maquinariasibarrola.com.ar/fotos/01741d0f867ffedc0e44cf118b87995e" class="img-responsive img-radio">Maquina #1</img> <div class="input-group"> <div id="radioBtn" class="btn-group"> <a class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">ENTERO</a> <a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">COLA</a> <a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">COLA</a> </div> <input type="hidden" name="happy" id="happy"> </div> <input type="checkbox" id="left-item" class="hidden"> </div> <div class="col-xs-3"> <img src="http://www.maquinariasibarrola.com.ar/fotos/01741d0f867ffedc0e44cf118b87995e" class="img-responsive img-radio">Maquina #2</img> <div class="input-group"> <div id="radioBtn" class="btn-group"> <a class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">ENTERO</a> <a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">COLA</a> </div> <input type="hidden" name="happy" id="happy"> </div> <input type="checkbox" id="left-item" class="hidden"> </div> <div class="col-xs-3"> <img src="http://www.maquinariasibarrola.com.ar/fotos/01741d0f867ffedc0e44cf118b87995e" class="img-responsive img-radio">Maquina #3</img> <div class="input-group"> <div id="radioBtn" class="btn-group"> <a class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">ENTERO</a> <a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">COLA</a> </div> <input type="hidden" name="happy" id="happy"> </div> <input type="checkbox" id="left-item" class="hidden"> </div> <div class="col-xs-3"> <img src="http://www.maquinariasibarrola.com.ar/fotos/01741d0f867ffedc0e44cf118b87995e" class="img-responsive img-radio">Maquina #4</img> <div class="input-group"> <div class="input-group"> <div id="radioBtn" class="btn-group"> <a class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">ENTERO</a> <a class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">COLA</a> </div> <input type="hidden" name="happy" id="happy"> </div> <input type="checkbox" id="left-item" class="hidden"> </div> </div> </form> </div> </div> </div>
.btn-radio { width: 100%; } .img-radio { opacity: 0.5; margin-bottom: 5px; } .space-20 { margin-top: 20px; } #radioBtn .notActive{ color: #3276b1; background-color: #fff; }
$('#radioBtn a').on('click', function(){ var sel = $(this).data('title'); var tog = $(this).data('toggle'); $('#'+tog).prop('value', sel); $('a[data-toggle="'+tog+'"]').not('[data-title="'+sel+'"]').removeClass('active').addClass('notActive'); $('a[data-toggle="'+tog+'"][data-title="'+sel+'"]').removeClass('notActive').addClass('active'); })

Related: See More


Questions / Comments: