关闭某些元素的jQuery UI工具提示 [英] Turn off jQuery UI tooltip for certain elements

查看:105
本文介绍了关闭某些元素的jQuery UI工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为简单起见,我想在页面的所有元素上启用jQuery UI工具提示小部件:

For simplicity, I'd like to enable the jQuery UI tooltip widget on all elements of the page:

然后对某些元素或元素及其后代禁用它.但这似乎不起作用:

Then disable it for certain elements or elements and their descendants. But this doesn't seem to work:

$(document).tooltip({ track: true });
$('#menu *[title]').tooltip({ disabled: true });

我的$('#menu *[title]')选择器似乎按预期工作,使所有具有#menu元素的title属性的后代元素.

My $('#menu *[title]') selector seems to work as I expect, getting all descendant elements that have a title attribute of the #menu element.

为什么.tooltip({ disabled: true });中的 disabled 选项不能在这些元素上禁用工具提示?有另一种方法和/或更好的方法来完成此任务吗?

So why isn't the disabled option working in .tooltip({ disabled: true }); to disable the tooltip on those elements? Is there another way and/or better way to accomplish this?

推荐答案

使用以下方法在所有元素上设置工具提示:

Set tooltip on all elements with:

$('*').tooltip();

并通过

$('#menu *[title]').tooltip('disable');

啦啦:

jsFiddle

这篇关于关闭某些元素的jQuery UI工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆