Hi,
I'll be interested to see the answers to this question, I'm sure
there's a better way than the way I've done it previously.
I needed to do something along those lines, keep track of which text
box the user was in before they clicked a button. I ended up keeping
track of the most recent text box in the form to get focus. I wasn't
using Prototype, but in Prototype it would look something like this:
// At some appropriate scope
var lastFocussed;
// In an init function, such as when DOM ready, or when you've
rendered the form
$('myform').
select('input[type=text], input[type=password], textarea,
select').
invoke('observe', 'focus', function() {
lastFocussed = this;
});
That will track which text, password, textarea, or select box last had
focus. Note that it doesn't track radio buttons or checkboxes; you
may want to do that, just add to the list of things being tracked in
the selector.
HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available
On Jul 20, 10:42 am, Tharapon Menkham <[email protected]> wrote:
> Sorry, the last selected element.
> I clicked textbox in form and click the link or button, so I want to
> know the textbox I've selected.
>
> Thank you,
> Tharapon
>
> On Jul 20, 4:39 pm, "T.J. Crowder" <[email protected]> wrote:
>
>
>
> > Hi,
>
> > What do you mean by previous? Previous in the DOM, previous in
> > time, ...? The more thorough you are in the info you provide, the
> > more people will be able to help.
> > --
> > T.J. Crowder
> > tj / crowder software / com
> > Independent Software Engineer, consulting services available
>
> > On Jul 20, 10:30 am, Tharapon Menkham <[email protected]> wrote:
>
> > > Does any know how to find the previous element which was clicked?
>
> > > Thank you so much,
> > > Tharapon
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---