Twitter Bootstrap Button Group Control Radio Buttons/Checkboxes

后端 未结 5 778
攒了一身酷
攒了一身酷 2021-01-30 16:15

I am trying to use the Twitter Bootstrap button group as an actual set of form input controls. By default, these button groups can be made to function like a radio button or che

5条回答
  •  既然无缘
    2021-01-30 16:52

    Bootstrap 3 has a "native" solution...

    There now is a "true" Bootstrap solution for this problem, which appears to work fine also on older browsers. Here's what it looks like:

    // get selection
    $('.colors input[type=radio]').on('change', function() {
        console.log(this.value);
    });
    
    
    
    

    See the relevant Bootstrap documentation for more information.

    Bootstrap 4

    Bootstrap 4 supports component the same way as Bootstrap 3, but Bootstrap 4 does not support IE9. You might want to check out the Bootstrap IE8 project.

提交回复
热议问题