I have on the page several text input tags. How to find which input
tag focused ?
Or how to observe all input tags at once ?
I''ve tried:
Event.observe($(''divID'').getElementsByTagName(''input''),
''focus'',
function(event) { } ); // invalid parameter
and
Event.observe(document.body, ''focus'', function(event) { } );
// dont
fire at all
and
$(''divID'').getElementsByTagName(''input'').each(
function(content) {
Event.observe(content, ''focus'', function(event) { } );
});
with no ant result. Hope you catch my logic !
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
OK, solved for now:
$(''divID'').select(''input'',
''[type="text"]'').each( function(e) {
Event.observe(e, ''focus'', function(event) { });
});
Only problem still occur:
select gives me all ''input'' elements but needed only those
with
type="text". What wrong above ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
My mistake ! Solved !
$(''divID'').select(''input[type=text]'').each(
function(e) {
Event.observe(e, ''focus'', function(event) { });
});
Thank You ! :)
On Jun 15, 7:09 am, mocambo <moca...-S7FoVGKkKTI@public.gmane.org>
wrote:> OK, solved for now:
>
> $(''divID'').select(''input'',
''[type="text"]'').each( function(e) {
> Event.observe(e, ''focus'', function(event) { });
>
> });
>
> Only problem still occur:
>
> select gives me all ''input'' elements but needed only
those with
> type="text". What wrong above ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
You might find #invoke [1] useful in this case:
$(''divId'').select(''input[type=text]'').invoke(''observe'',
''focus'',
function(e) { ... });
[1] http://prototypejs.org/api/enumerable/invoke
- kangax
On Jun 15, 12:34 am, mocambo <moca...-S7FoVGKkKTI@public.gmane.org>
wrote:> My mistake ! Solved !
>
>
$(''divID'').select(''input[type=text]'').each(
function(e) {
> Event.observe(e, ''focus'', function(event) { });
>
> });
>
> Thank You ! :)
>
> On Jun 15, 7:09 am, mocambo <moca...-S7FoVGKkKTI@public.gmane.org>
wrote:
>
> > OK, solved for now:
>
> > $(''divID'').select(''input'',
''[type="text"]'').each( function(e) {
> > Event.observe(e, ''focus'', function(event) {
});
>
> > });
>
> > Only problem still occur:
>
> > select gives me all ''input'' elements but needed only
those with
> > type="text". What wrong above ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Thanks for invoke() ! :) On Jun 15, 5:56 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You might find #invoke [1] useful in this case: > > $(''divId'').select(''input[type=text]'').invoke(''observe'', ''focus'', > function(e) { ... }); > > [1]http://prototypejs.org/api/enumerable/invoke > > - kangax > > On Jun 15, 12:34 am, mocambo <moca...-S7FoVGKkKTI@public.gmane.org> wrote: > > > My mistake ! Solved ! > > > $(''divID'').select(''input[type=text]'').each( function(e) { > > Event.observe(e, ''focus'', function(event) { }); > > > }); > > > Thank You ! :) > > > On Jun 15, 7:09 am, mocambo <moca...-S7FoVGKkKTI@public.gmane.org> wrote: > > > > OK, solved for now: > > > > $(''divID'').select(''input'', ''[type="text"]'').each( function(e) { > > > Event.observe(e, ''focus'', function(event) { }); > > > > }); > > > > Only problem still occur: > > > > select gives me all ''input'' elements but needed only those with > > > type="text". What wrong above ?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---