Auto-populating SELECT fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drmc09
    New Member
    • Jul 2009
    • 1

    Auto-populating SELECT fields

    Hello All,

    I am trying to autopopulate a SELECT INPUT field using an onClick function.
    I can change value (i think), but am wondering how i change the text that is between the OPTION tags?

    document.forms. formname.select name.????? = 'what i want it to change to'...

    Many Thanks,
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You'll have to first access the correct option element:
    Code:
    sel.options[i].text
    where 'sel' is the select object and 'i' is the 0-based index to the option.

    Comment

    Working...