[jQuery] Re: Finding the element which has focus

2008-07-22 Thread Karl Rudd
Correct. The only way to reliably find out what element current has focus is to bind a focus handler to all the elements that might take focus on the page. When an element gets focus, you note it down. For example: var currentFocus = null; $(':input').focus( function() { currentFocus = this;

[jQuery] Re: Finding the element which has focus

2008-07-22 Thread Joel Newkirk
I don't think that'll work out as you expect... $(selector).focus() GIVES $(selector) the focus, it doesn't test whether it already HAS focus. Ideally there would be a selector such as :focus, fitting in with :enabled, :selected, :hidden, and others. j On Mon, Jul 21, 2008 at 5:27 PM, jquertil

[jQuery] Re: Finding the element which has focus

2008-07-21 Thread jquertil
you should be able to return the focus() event. if( $('#navTable').focus() == true ) might need to play with the selector to get it right.

[jQuery] Re: Finding the element which has focus

2008-07-21 Thread Joel Newkirk
Try stuffing values into a variable from the onFocus() event of each of the tables. Or add/remove an additional class when a table gets/loses focus. You can find the focused table quickly that way, and apply different styling if desired based on the class 'focused' or whatever. j On Sun, Jul