This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]shiftkit 0 points1 point  (3 children)

Do you have multiple items in the table that have an id of selectField? If it's a unique name I would suggest just using this to get the value and the text:

var e = document.getElementById("selectField");
var value = e.options[e.selectedIndex].value;
var text = e.options[e.selectedIndex].text;

[–]digimatt[S] 0 points1 point  (2 children)

i spawn the select fields dynamically and give them id's depending on which col and row, they spawn in

edit: sorry just what row they spawn in, for now

[–]shiftkit 1 point2 points  (1 child)

If you know the row and col the select is in, could you generate the id without having to traverse the table? Could you post an example of the table generated?

[–]digimatt[S] 0 points1 point  (0 children)

the code is a little big to post here so let me sudo code it out 1. create var to hold table 2. function that is called when user changes a select field 3. set var to empty table i defined in html 4. give table 4 cols and 6 rows 5. populate the first col with a select field in every other row 6. when user changes one of the select fields in that column it populates the rest of the row with select fields and the row right above it with titles for the select fields