I have a way in HTML and JavaScript . I need by code to assign to each line of a table, which have status 1 , a subaddress through a combo (resolved this part).
The problem is that I need to duplicate any row using a button so that this same line duplicated (resolved), has status 2 to be able to differentiate them (unresolved part). I use a hidden where I save the status and it is embedded in the column of a table.
The problem is that I can not find how to reference the row where I press the duplicate button to change its value:
The button calls this function JavaScript :
function duplica_numeral(nI,numeral_id,of_au_id,au_id){
//alert("Entro a duplicar numeral " );
var oTabla = document.getElementById("Tab_Numerales");
var nFilas = oTabla.rows.length;
var row = document.getElementById("numeral"+nI); // find row to copy
var clone = row.cloneNode(true); // copy children too
clone.id = "numeral"+nFilas; // change id or other attributes/contents
clone.getElementsByTagName('select')[0].id = "comboAtencion" + nFilas;
alert("Before change to c ( hidNumeral has value 'a' " ); // This line runs
clone.getElementById('hidNumeral').value = 'c'; // this line is incorrect, why ??
alert("after change to c " ); // This line does not run
}
HTML Code:
<table width="100%" border="0" cellpadding="0" id="Tab_Numerales" >
<tr height="25%" bgcolor="<?php echo $vcolor; ?>"
name="numeral<?echo$i;?>" id="numeral<?echo$i;?>">
<td align="center" class="rows"><?php echo $i; ?></td>
<td align="center" class="rows"><?php echo $row['numeral']; ?></td>
<td align="center" class="rows"><input name="hidNumeral" type="text" id="hidNumeral"
I want to put table hidnumeral
in status 2 .