How do I Update the Content in Jquery UI Tooltip in Realtime?

后端 未结 6 1842
我在风中等你
我在风中等你 2020-12-31 01:58

I have an element that when hovered over, it displays the price of the item (in a game). I\'m using the jQuery UI tooltip to power the display of the information about each

6条回答
  •  无人及你
    2020-12-31 02:42

    My first answer was wrong, sorry about that.

    paragraph

    javascript:

    function reloadToolTip(text){
      $('#mybody p').tooltip({contents:text});
    }
    

    You can recall the tooltip and change the contents. This will change the tooltip but not until you rehover.

    Edit:

    I think I found something that will work. Just close and reopen the tooltip. The tooltip will contain the new text.

    function reloadToolTip(text){
      $('#mybody p').tooltip({contents:text}).tooltip('close').tooltip('open');
    }
    

提交回复
热议问题