如何使jQueryUI工具提示仅适用于焦点

时间:2012-11-05 13:40:57

标签: jquery-ui jquery-ui-tooltip

如何才能在focus上显示新的JqueryUI工具提示:目前它位于focushover上。我相信这是自JqueryUI 1.9以来的

2 个答案:

答案 0 :(得分:36)

有点短道路:

$(".selector").tooltip().off("mouseover mouseout");

答案 1 :(得分:13)

这不太理想,但应该有效:

$(".selector").tooltip({
    disabled: true
}).on("focusin", function () {
    $(this)
        .tooltip("enable")
        .tooltip("open");
}).on("focusout", function () {
    $(this)
        .tooltip("close")
        .tooltip("disable");
});

基本上,启用/打开focusin上的工具提示并禁用/关闭focusout

示例: http://jsfiddle.net/WmRuN/