Refresh an element so its new tooltip shows (in jQuery/Javascript)

后端 未结 4 1144
挽巷
挽巷 2021-01-12 06:54

I have an html element which is using bootstrap tooltip to show a title when hovering over it. However, when you click this element I\'m changing the tooltip, but the new to

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 07:40

    Sure you just have to change the tooltips text within the onclick event

    $('.tooltip-inner').html("This is a test");
    

    I've created a jsfiddle for you as a demonstration http://jsfiddle.net/a4WwQ/59/

    Currently it will change all visible tooltips text which isnt really a problem since you arent going to show more than one at at a time. That being said, you should consider modifying the code to point to the closest tooltip.

    hope it helps!

提交回复
热议问题