Hi,
I want the background color to change if I focus on an input field.
It works when I specify $(''fieldname'') for example, but I want
to use
it on all the input fields on the page.
So I used the $$(''input'') but that''s ain''t
working...
Anyone got a solution for this?
Code:
http://pastebin.com/m9691ea3
Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
$$(''input'').each(function(s) {
s.observe(''click'', makeActive);
s.observe(''blur'', removeActive);
}
$$(''input'') returns an array of input elements. You need to
iterate
through them all and apply the observers.
Bernie
On Apr 24, 10:25 am, zabulus
<zabulu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> I want the background color to change if I focus on an input field.
>
> It works when I specify $(''fieldname'') for example, but I
want to use
> it on all the input fields on the page.
> So I used the $$(''input'') but that''s
ain''t working...
>
> Anyone got a solution for this?
>
> Code:http://pastebin.com/m9691ea3
>
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
a better way is to use event delegation and only attach 2 event observers for the entire form. see: http://pastie.caboo.se/186221 - JDD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---