I have a dropdown list on each cell of table row. Now what I need is dynamically add more dropdownlist on a particular cells with pressing the add button. Any code snippet to help on this? Thank you.
newbie14 0
Posting Pro
Recommended Answers
Jump to PostDo you mean something like this?
var target_cell = document.getElementById("cell_id"); var list = "<select>" + "<option value=\"value1\">Val 1<\/option>" + "<option value=\"value2\">Val 2<\/option>" + "<\/select>"; target_cell.innerHTML = list;
Jump to PostOk. I've written a new addSubRow function
function addSubRow2(cell){ var dropdown = "<SELECT class=\"select\" name=\"country\">\n" + "<OPTION value=\"in\">India<\/OPTION>\n" + "<OPTION value=\"de\">Germany<\/OPTION>\n" + "<OPTION value=\"fr\">France<\/OPTION>\n" + "<OPTION value=\"us\">United States<\/OPTION>" + "<OPTION value=\"ch\">Switzerland<\/OPTION>" + "<\/SELECT>"; cell.innerHTML += "<br\/ >" + dropdown; }
the onclick attribute for the button …
All 8 Replies
theHop 18
Newbie Poster
newbie14 0
Posting Pro
theHop 18
Newbie Poster
newbie14 0
Posting Pro
newbie14 0
Posting Pro
theHop 18
Newbie Poster
newbie14 0
Posting Pro
newbie14 0
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.