Bootswitch for Bootstrap

This plugin created for Bootstrap Button Groups. It's only 2kb! (1kb when minified :] ) You can create switchable buttons with hidden inputs. Fully customizeable with options:


You need jQuery, Bootstrap, and plugin js file.

<link rel="stylesheet" href="//">
<script src="//"></script>
<script src="//"></script>
<script src="yoursitepath/bootswitch.min.js"></script>

After that you can simply insert this code

    jQuery(document).ready(function($) {

Your bootstrap button group should be;

<div class="btn-group" data-toggle="buttons-radio">
    <button type="button" class="btn btn-info yes" data-toggle="button">Yes</button>
    <button type="button" class="btn btn-info no" data-toggle="button">No</button>

<input type="hidden" id="showm" class="form-control" />

Plugin Options & Default Values

You can customize plugin with this options. The options;

    object: this, //the value 'class' of button group. generally '.btn-group'
    positive: '.yes', //positive div (button) (should be class or id)
    negative: '.no', //negative div (button) (should be class or id)
    posval: 'yes', //positive button value (should be string or integer)
    negval: 'no', //negative button value (should be string or integer)
    input: '#showm' //target input id

Plugin Usage With Options

    jQuery(document).ready(function($) {
            positive: '.yes',
            negative: '.no',
            posval: 'yes',
            negval: 'no',
            input: '#showm'


Bootstrap Demo


jQuery(document).ready(function($) {
Fork me on GitHub