[development] using jquery to access a form element
Lluís Forns
enboig at gmail.com
Wed Jun 23 12:45:27 UTC 2010
I was hoping to find a way to tell my js code which id would have the
form element.
I inserted my js code inside the form()
2010/6/23 nan wich <nan_wich at bellsouth.net>:
> Actually, if the same form is used more than once on a page, you can almost
> guarantee that it will *not* have the same name. Take a look at the comments
> in "form_clean_id()" concerning its effects on jQuery. I think adding a
> class might make this more difficult, unless that code is fully aware of
> multiple instances of a form on a page.
>
>
> Nancy E. Wichmann, PMP
>
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
> Jr.
>
> ________________________________
> From: Steven Jones
>
> However, you cannot therefore guarantee that the form element will
> always have the same ID.
>
> Usually I'd add a class to the item I want to add the behaviour to (in
> form alter or theme function), and then attach the javascript using
> the Drupal.behaviors technique.
>
> Regards
> Steven Jones
--
*Les normes hi són perquè hi pensis abans de saltar-te-les
*La vida és com una taronja, què esperes a exprimir-la?
*Si creus que l'educació és cara, prova la ignorància.
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.
More information about the development
mailing list