select option in each row of table. after gave inputs to that table, how can i get each row’s select tag value and its text in a for loop
its my size table script
function sizeadd()
{
var mytable = document.getElementById("sizenames");
var rows = mytable.rows.length;
var r1 = mytable.insertRow(rows);
r1.id = mytable.rows.length-1;
var c1 = r1.insertCell(0);
var c2 = r1.insertCell(1);
var checkbox = document.createElement("input");
checkbox.type = "checkbox";
var txtSizePop = document.createElement("select");
txtSizePop.style.width = '100px';
txtSizePop.className = 'txtSizeSelection';
txtSizePop.id="txtSizePop"+r1.id;
c1.appendChild(checkbox);
<?php
require('connection.php');
$sqlSize = "select * from msize order by name asc";
$rsSize = mysqli_query($con, $sqlSize);
?>
var sizeoption = document.createElement("option");
sizeoption.value = "-1";
sizeoption.text = "Select Size";
txtSizePop.appendChild(sizeoption);
c2.appendChild(txtSizePop);
<?php while ($row = mysqli_fetch_array($rsSize)) { ?>
var sizeoption = document.createElement("option");
sizeoption.value = "<?php echo $row["code"]; ?>";
sizeoption.text = "<?php echo $row["name"]; ?>";
sizeoption.label = "<?php echo $row["name"]; ?>";
txtSizePop.appendChild(sizeoption);
c2.appendChild(txtSizePop);
<?php } ?>
}
i am trying this table’s select tag value and text in other one script
function SizeUpdate()
{
var mystyletable4U = document.getElementById("sizenames");
var rows = mystyletable4U.rows.length;
for(var i = 1; i <= rows-1 ; i++)
{
alert(i);
var Rowid4Siz = mystyletable4U.rows[i].cells[1].children[0].value;
var Label4Siz = mystyletable4U.rows[i].cells[1].children[0].text;
}
here i got select tag value, but unable to get text