| Author |
DOM and adding a brand new select list
|
Rob Hunter
Ranch Hand
Joined: Apr 09, 2002
Posts: 788
|
|
Can anyone tell me or show me how I can dynamically add a new row to a table and in one of the newly added cells add a brand new select list? The cells I'm adding using DOM are fine but when I try putting in the select list it doesn't work. For example, if I try and set the cell's innerText it just displays the tag for the select list. If I try and set the innerHtml it gives me nothing. Any help would be appreciated. Thanks.
Rob
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
Where's your code?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
with a select you should be use new Option()
Eric
|
 |
binayakumar patel
Greenhorn
Joined: Jun 26, 2009
Posts: 27
|
|
This may Help you.
|
 |
binayakumar patel
Greenhorn
Joined: Jun 26, 2009
Posts: 27
|
|
Inplace of
# var option1 = document.createElement("OPTION")
# option1.text="Banana"
# option1.value=1
# selectBox.options.add(option1)
We can use:
selectBox.options[selectBox.options.length]=new Option("Banana","1")
|
 |
 |
|
|
subject: DOM and adding a brand new select list
|
|
|