I want to add a new row to the button on a table. The new row will have a text box and a drop-down. Option of dropdown (selection element) to be added to the session attribute
I am able to add text boxes using the following functions. I have a session attribute "type" I want to add a drop down list as the second column where the line is marked as type < / Strong>. I am setting the attribute "type" on the page when I am using the Java Servlet for the server server. Any help is appreciated Thanks If you have a session type" type "then you can do this in such a way. Post the rest of the remaining coding so that I can update my answer. function addRow (BTN) {var parentRow = btn.parentNode.parentNode; Var Table = Perrentro Parent node; Var rowCount = table.rows.length; Var line = table.insertRow (rowCount); Var cell1 = row.insertCell (0); Var element1 = document.createElement ("input"); Element1.type = "text"; Element1.name = "abc"; Cell1.appendChild (element1); Var cell3 = row.insertCell (1); Var element2 = document.createElement ("select"); Var option1 = document.createElement ("Options"); Option1.innerHTML = "Option1"; Option1.value = "1"; Element2.appendChild (option1, blank); }
var type = 'option1'; Append ('<'> & lt; td & gt; '+' gt; + '& lt; select & gt; & lt; option & gt; ; + Type + '& lt; / option & gt; & lt; / select & gt;' + ' & lt; / tr & gt;'); } & Lt; Table id = "tblTest" & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "data1" value = "tempdata" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "button" value = "add" onclick = "addRow ()" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt;
No comments:
Post a Comment