jquery-ui - jQuery : How to disable/make exception for only one tag?

标签 jquery-ui

我正在使用 .tooltip 对整个页面中的每个进行简单描述。除了页面的标题名称(不仅仅是图标和菜单)显示在屏幕的左下角之外,它对所有内容都非常有用。如何仅对以“step”开头的标题标签进行异常(exception)处理?谢谢。

$.widget( "ui.tooltip", {
version: "1.9.2",
options: {
    content: function() {
        return $( this ).attr( "title" );
    },
    hide: true,
    // Disabled elements have inconsistent behavior across browsers (#8661)
    items: "[title]:not([disabled])",
    position: {
        my: "left top+15",
        at: "left bottom",
        collision: "flipfit flip"
    },
    show: true,
    tooltipClass: null,
    track: false,

    // callbacks
    close: null,
    open: null
},

最佳答案

只需为您的 items 定义使用普通的 jquery 选择器:

items: '[title^="step"]:not([disabled])',

应该可以解决问题,要获得更多选择器的乐趣,请参阅 jquery selector documentation

@编辑: 我刚刚重新阅读了您的问题,要排除标题开头带有“步骤”一词的项目,请使用:

items: '[title]:not([disabled]):not([title^="step"])',

关于jquery-ui - jQuery : How to disable/make exception for only one tag?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13746572/

相关文章:

javascript - 拖放 HTML 有限制

javascript - IE9 和 jQuery : Sorting list items works in modern browsers and IE7, 但不是 IE9。

jQuery 显示/隐藏不触发回调

html - 为什么 jQuery UI Spinner 箭头按钮不显示?

javascript - jQueryui 可拖动项类

javascript - jquery ui 中 iframe div 内的可放置 div

javascript - jQuery UI 可拖动不适用于创建的元素

jquery ui datepicker字体大小很大

javascript - 套索可选禁用 CSS :hover state

html - 样式 ul 宽度以容纳元素