faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 5 people (60%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

How do I reference a select box with [] in the name?

Feb 3rd, 2005 04:38
jsWalter, James Ward,


Even thought FOrm Objects can have the same name, they must have unique 
IDs. 
When I create a form with multiple (say) SELECT Items, they have the 
name of 'field[]' but they have IDs of 'field_1', 'field_2', etc 
Then I can reference them... 
    field_1 = document.getElementById('field_1'); 
Walter