Search code examples
javascripttwitter-bootstrapcheckboxglyphicons

Glyphicons no longer supported in Bootstrap 4


I've read, from official docs, that Glyphicons were dropped from Bootstrap 4.

Today, in my searching for implementing checkbox button, I've found one snippet that I appreciate very much:

Snippet for Checkbox 3.0

The problem is that this version is for Bootstrap 3.0, where Glyph were supported yet.

So I've 2 question:

  1. Which is a good alternative to Glyphicons? Or there is a way to use them yet?
  2. How I may change the html and js snippet above to make it working with Bootstrap 4?

Solution

  • 1 - Which is a good alternative to Glyphicons? Or there is a way to use them yet?

    The best alternative IMHO: http://fontawesome.io/icons/

    2 - How I may change the html and js snippet above to make it working with Bootstrap 4?

    jQuery Checkbox Buttons - Bootstrap 4

    You need to change the JS:

    settings = {
        on: {
            icon: 'fa fa-square-o'
        },
        off: {
            icon: 'fa fa-check-square-o'
        }
    };
    

    And the CSS class .hidden is now deprecated so Bootstrap recommends to use style="display: none" instead.