How to enable Bootstrap tooltip on disabled button?

后端 未结 18 2456
爱一瞬间的悲伤
爱一瞬间的悲伤 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:13

    Based on Bootstrap 4

    Disabled elements Elements with the disabled attribute aren’t interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a workaround, you’ll want to trigger the tooltip from a wrapper or , ideally made keyboard-focusable using tabindex="0", and override the pointer-events on the disabled element.

    
      
    
    

    All the details here: Bootstrap 4 doc

提交回复
热议问题