If a dom element is :visible, will it always be focussable? 
            Asked
            
        
        
            Active
            
        
            Viewed 72 times
        
    0
            
            
        
        John Conde
        
- 217,595
 - 99
 - 455
 - 496
 
        Ken Hirakawa
        
- 7,831
 - 10
 - 38
 - 49
 
- 
                    See this question: http://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus – Surreal Dreams May 01 '12 at 14:57
 
3 Answers
0
            
            
        It's not guaranteed, but you can check to see if an element will fire the focus event.
var focussableEls = [];
$(":visible").each({
    if (typeof this.focus == 'function')
        focussableEls.push(this.id);
});
console.log(focussableEls);
        Rory McCrossan
        
- 331,213
 - 40
 - 305
 - 339
 
- 
                    That appears to come back with html, body and every element in the body, not just those that can be focused. http://jsfiddle.net/TEL4J/ – Quentin May 01 '12 at 15:15
 
0
            
            
        Check for elements that have a tabindex attribute:
$('[tabindex]')
        Alnitak
        
- 334,560
 - 70
 - 407
 - 495
 
- 
                    Elements don't have to have a tabindex attribute to be focusable (e.g. an input element is focusable by default). – Quentin May 01 '12 at 15:11