I am using Jquery UI's tooltip widget to display help text. I have then added a button to disable the helptext. This is done by using the following when a button is pressed.

$(document).tooltip("disable");   

The problem is when I do this the text in the tag is removed. By enabling the tooltip again the text comes back.

The problem is When the tooltip is enabled the tab in the browers says: "MyCompany" but when the title is removed when disabling the tooltip it changes the https:// mycompany.com.

Is there something I am missing? How do I avoid the page title from being removed?

有帮助吗?

解决方案

It seems that using $(document) as a selector for tooltips affects the html <title> tag. The solution is to be more specific with the selector:

$('.has-tooltip').tooltip();

(add a class - eg:has-tooltip - to all the elements that will receive a tooltip).

However, you can use even general selectors, like:

$('*').tooltip();

or

$('body').tooltip();

Update This issue is limited to jQuery versions previous to v2. Using $(document) as selector should work fine for jQuery 2.x. (thanks @Ayman Safadi for your research).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top