Adding custom class to tooltip

后端 未结 8 972
一生所求
一生所求 2021-02-05 02:04

I want to style(css) some bootstrap-tooltip.js tooltips, without affecting all the tooltips. I have tried many different solutions but i allways end up adding a class to the ele

相关标签:
8条回答
  • 2021-02-05 02:55

    Prior to Bootstrap 4:

    $().tooltip({
      template: '<div class="tooltip CUSTOM-CLASS"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
    })
    

    Bootstrap 4:

    $().tooltip({
      template: '<div class="tooltip CUSTOM-CLASS" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
    })
    
    0 讨论(0)
  • 2021-02-05 02:58

    Try setting the html option to true and inserting something like <span class="test">YOUR TEXT</span> into the title option.

    $(function(){
      $("[id$=amount]").tooltip({
        trigger: 'manual',
        placement: 'right',
        html: true,
        title: '<span class="test">YOUR TEXT</span>'
      });
    }); 
    

    I honestly am not sure if this will work, but I believe it's worth a shot.

    EDIT: After reading this post it may be more helpful.

    0 讨论(0)
提交回复
热议问题