Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
  <h3>jQuery Checkbox Buttons<br />
    <small>Buttons that change the state of their own hidden checkboxes, and vice-versa!<br>
      Source: <a></a>
  <div class="input-group col-md-4">
    <span class="button-checkbox input-group-btn">
      <button type="button" class="btn" data-color="primary">Option One</button>
      <input type="checkbox" class="hidden" checked />
    <span class="button-checkbox input-group-btn">
      <button type="button" class="btn" data-color="primary">Option Two</button>
      <input type="checkbox" class="hidden" />
    <span class="button-checkbox input-group-btn">
      <input type="checkbox" class="hidden" checked />
      <button type="button" class="btn" data-color="primary">Option Three</button>


                *:focus {
  outline: none !important;

.input-group-btn .btn {
  width: 100%;

:not(:first-child):not(:last-child).input-group-btn.button-checkbox .btn {
  border-radius: 0px;


                $(function () {
  $('.button-checkbox').each(function () {

    // Settings
    var $widget = $(this),
        $button = $widget.find('button'),
        $checkbox = $widget.find('input:checkbox'),
        color = $'color'),
        settings = {
          on: {
            icon: ''//'glyphicon glyphicon-check'
          off: {
            icon: ''//'glyphicon glyphicon-unchecked'

    // Event Handlers
    $button.on('click', function () {
      $checkbox.prop('checked', !$':checked'));
    $checkbox.on('change', function () {

    // Actions
    function updateDisplay() {
      var isChecked = $':checked');

      // Set the button's state
      $'state', (isChecked) ? "on" : "off");

      // Set the button's icon
        .addClass('state-icon ' + settings[$'state')].icon);

      // Update the button's color
      if (isChecked) {
          .addClass('btn-' + color + ' active');
      else {
          .removeClass('btn-' + color + ' active')

    // Initialization
    function init() {


      // Inject the icon if applicable
      if ($button.find('.state-icon').length == 0) {
        $button.prepend('<i class="state-icon ' + settings[$'state')].icon + '"></i> ');