I'm adding row in the table using createElement function using Javascript when user click a button.
But I want to add checkbox on the first column of eacch row being added.
How can I do it using javascript?
I can add text using createElement into <td> but, I don't know how to add checkbox into <td>..
Is it possible? if so, please reply.
And reply with how to get the value of the added check box in code in the case user click submit.
Thank you.
-- this is the function adding rows.
function addRow(id,strBarcode,strTranID){
var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR")
var td1 = document.createElement("TD")
td1.appendChild(document.createTextNode(" "))
var td2 = document.createElement("TD")
td2.appendChild (document.createTextNode(strBarcode))
var td3 = document.createElement("TD")
td3.appendChild (document.createTextNode(strTranID))
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
tbody.appendChild(row);
}
-- the row is added to following table in the page..
<table id="BarcodeTable" width="670" border="1" cellPadding="0" cellSpacing="0" topmargin="0" leftmargin="0">
<tbody>
<tr>
<td class="ColHeader" width=30 align=left style="font-weight:bold"> </td>
<td class="ColHeader" width=74 align=left style="font-weight:bold"> Barcode </td>
<td class="ColHeader" width=74 align=left style="font-weight:bold"> TranID </td>
<td class="ColHeader" width=74 align=left style="font-weight:bold"> ItemCode </td>
<td class="ColHeader" width=74 align=left style="font-weight:bold"> ColorID </td>
<td class="ColHeader" width=74 align=left style="font-weight:bold"> SizeID </td>
</tr>
</tbody>
</table>