How can I make the new JqueryUI tooltip visible only on focus: At the moment its on focus and on hover. I believe this is since JqueryUI 1.9
            Asked
            
        
        
            Active
            
        
            Viewed 1.9k times
        
    26
            
            
         
    
    
        Andrew Whitaker
        
- 124,656
- 32
- 289
- 307
 
    
    
        Mark W
        
- 5,824
- 15
- 59
- 97
- 
                    Wow such a simple question but I don't see a simple answer :( – Andrew Whitaker Nov 05 '12 at 19:09
2 Answers
38
            A bit shorter way:
$(".selector").tooltip().off("mouseover mouseout");
 
    
    
        lxgreen
        
- 1,511
- 15
- 14
- 
                    14+1 this worked for what I needed, the opposite, wanted them on mouse only, not focus: $(element).tooltip().off("focusin focusout"); – eselk Apr 01 '13 at 21:53
- 
                    1An add-on to the answer: `.off("mouseover mouseout");` will off all mouse over/out events. If you are using them, they will be unbind too. To make sure you are just doing `off` on the tooltip's ones, do like this: `$(".selector").tooltip(); var tooltipInstanceNamespace = $(".selector").tooltip("instance").eventNamespace; $(".selector").off('mouseover'+tooltipInstanceNamespace' mouseout'+tooltipInstanceNamespace);` This will off only the listeners with that tooltip instance namespace. – RaphaelDDL Oct 03 '14 at 18:28
15
            
            
        This isn't ideal, but it should work:
$(".selector").tooltip({
    disabled: true
}).on("focusin", function () {
    $(this)
        .tooltip("enable")
        .tooltip("open");
}).on("focusout", function () {
    $(this)
        .tooltip("close")
        .tooltip("disable");
});
Basically, enable/open the tooltip on focusin and disable/close on focusout.
Example: http://jsfiddle.net/WmRuN/
 
    
    
        Andrew Whitaker
        
- 124,656
- 32
- 289
- 307
- 
                    
- 
                    2Also. One problem I didn't think about with this, is that the browser inserts the standard titles on hover. :( – Mark W Nov 08 '12 at 10:21