[development] using jquery to access a form element
nan wich
nan_wich at bellsouth.net
Wed Jun 23 11:52:41 UTC 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100623/0b327842/attachment.html
More information about the development
mailing list