I couldn't find a DOM or Javascript-specific way to to that. One way
to hack around thathe would be to assign a function to onFocus and
onBlur events like this:

var focusedElement = null;

Event.observe(window,'load',function() {
        $$('input, select, textarea').each(function(e){
                e.observe('focus',function(e){
                        return function() { focusedElement = e; }
                }(e));
                e.observe('blur',function(e){
                        return function() {
                                if (focusedElement==e)
                                        focusedElement = null;
                                }
                }(e));
        });
});

As a result, focusedElement will either have the focused element or
null of none.

Hope my haccome have been of value,
- Baglan

p.s. Sorry for rather unintelligible code :)

On Feb 18, 5:43 pm, "KreatiK'" <krea...@gmail.com> wrote:
> Hi all J
>
> It's possible to retrieve the currently focused element with prototype ?
>
> Thanks !
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to