How to enable Bootstrap tooltip on disabled button?

后端 未结 18 2495
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 23:18

I need to display a tooltip on a disabled button and remove it on an enabled button. Currently, it works in reverse.

What is the best way to invert this behaviour?

18条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 00:12

    You can simply override Bootstrap's "pointer-events" style for disabled buttons via CSS e.g.

    .btn[disabled] {
     pointer-events: all !important;
    }
    

    Better still be explicit and disable specific buttons e.g.

    #buttonId[disabled] {
     pointer-events: all !important;
    }
    

提交回复
热议问题