Is it posible to make an input checkbox a Bootstrap glyphicon?

后端 未结 3 1041
一整个雨季
一整个雨季 2020-12-18 16:11

Is it posible to make an input checkbox a Bootstrap glyphicon?

I want to make up the default checkboxes with a nice Bootstrap glyphicon. For example: glyphicon

3条回答
  •  Happy的楠姐
    2020-12-18 16:28

    You can achieve that in a couple of methods:

    Method 1

    • inside a tag, two that represent the icons that you want need to be placed(or outside, per use scenario)
    • then toggle these two , when the input[type='checkbox'] is checked or unchecked
    • done.

    Method 2

    • a cleaner approach to the above one, would be to use the css from bootstraps icons, and place them in a :before(or :after depending on your scenarion) on the tag
    • then toggle the content prop. of the :before class, that the icons that you want have, when the input[type='checkbox'] is checked or unchecked
    • done.

    Check out the demo here and also, a couple of more through documentation on this matter:

    • Add boostrap icon to input boxes
    • Boostrap checkbox documentation

提交回复
热议问题