On Monday, February 21, 2011 07:53:03 am hank23 wrote:
> I have an html page which I'm trying to code. On it I have a form with
> multiple html controls/elements. In order to reference the elements on
> the page can I reference them directly with a
> document.getElementBy('') or do I need to reference them with the form
> id as a prefix? If so how do I code that or where can I find one or
> more examples of how to do that? Thanks.

The short answer is No, you do not need the form id as a prefix in general.
With jquery you can use various types of selectors[1] to find elements, but 
for the most part you just need the elements class name[3] or id[2][4].  

Personally I suggest using jquery and using id's for selecting most elements 
unless you have a group of similar elements, like a bunch of text inputs that 
are a series of names, then class's would be a better choice to select them.,

Mike.


[1]http://api.jquery.com/category/selectors/

[2]https://developer.mozilla.org/en/DOM/document.getElementByID

[3]https://developer.mozilla.org/en/DOM/document.getElementsByClassName

[4]http://www.tizag.com/javascriptT/javascript-getelementbyid.php


-- 
I've always made it a solemn practice to never drink anything stronger
than tequila before breakfast.
                -- R. Nesson

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to