Very possible.
// to select all elements with class error-message
$$(''.error-message'');
// to select all elements with class error-message which follow
element with id LinkEmail
$$(''#LinkEmail + .error-message'');
- kangax
On Jun 11, 12:52 am, Max <ioni...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hey guys, I am trying to target error class elements with Prorotype. I
> am using it with the CakePHP framework so adding IDs will be difficult
> and I''d rather not modify the core cakephp functions.
Here''s my sample
> HTML:
> <form id="LinkEditForm" method="post"
action="/sourcing/links/edit/
> 29"><fieldset style="display:none;"><input
type="hidden"
> name="_method" value="PUT" /></fieldset>
> <fieldset>
> <legend>Name</legend>
> <span>
>
> <label for="LinkName">Name</label><input
name="data[Link]
> [name]" type="text" maxlength="20"
size="20" class="req"
> value="Maxmie" id="LinkName" /><div
class="error-message">TEST2</
> div>
> </span>
> <span>
> <label for="LinkEmail">Email</label><input
name="data[Link]
> [email]" type="text" size="20"
class="req" maxlength="40"
> value="m...-f9B/kR0Sgr8AvxtiuMwx3w@public.gmane.org"
id="LinkEmail" /><div class="error-
> message">TEST</div>
> </span>
> </fieldset>
> <div class="submit"><input type="submit"
value="Submit" /></div></
> form>
>
> Now, I want to be able to target the error-message divs per span. Is
> there a way to do that? GetElementByClassName has been deprecated and
> it doesn''t really help me anyway. I''m pretty sure what
I''m asking is
> impossible but I also know there are very smart people on this mailing
> list. So, targeting the error-message div that comes right after a
> certain input id is possible?
>
> Max
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---