Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Assign a value to a Option of a Combo on the fly

 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a function that creates a Combo box on the fly:





I want to be able to call the following function and execute a code base on the selection of the Combo:



I guess is not working because I don't know how to assign a value to the Combo on the fly.

Any helpt would be highly appreciate.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch,

samuel marin wrote:I have a function that creates a Combo box on the fly:

No. There's no such things as a "combo". I assume you mean a select dropdown? Please read: HtmlHasNoComboBox

Also, your code will be much easier to read with proper indentation. I'd suggest editing your post. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give the element an id value and then use document.getElementById() to reference it.
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to delete this post so I could create an acurate one with the correction that you mentioned.

I'm still don't know how to solve my issue.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic