How to change placement of Twitter-Bootstrap tooltip placement after initialization?

后端 未结 3 1816
無奈伤痛
無奈伤痛 2021-01-01 17:30

I want to change placement of a Bootstrap tooltip on a text box after it has been already initialized:

// these don\'t work
$(\'#myTextbox\').tooltip({ place         


        
相关标签:
3条回答
  • 2021-01-01 18:17

    In Bootstrap 2.x, the answer is as ajbeaven states:

    $('#myTextbox').data('tooltip').options.placement = 'right';
    

    However, from Bootstrap 3, all Bootstrap data is namespaced with bs:

    $('#myTextbox').data('bs.tooltip').options.placement = 'right';
    
    0 讨论(0)
  • 2021-01-01 18:27

    Ahh, found the answer:

    $('#myTextbox').data('tooltip').options.placement = 'right';
    
    0 讨论(0)
  • 2021-01-01 18:30

    Adding to Ben Cox's response, in Bootstrap 4 use:

    $('#myTextbox').data('bs.tooltip').config.placement = 'right';
    
    0 讨论(0)
提交回复
热议问题