I am printing rows in a talbe as follows. when btnDes cell is clicked, I am able to captuer the variable from the java script.
When the same table is printed via AJAX, same javascript code is not able to capture the event and variables.
Can somebody tell me how to do this?
$counter = 0;
while ($row = $db->getAssocArr($results)) {
?>
<form action="form.php" method="post" id="form-<?php echo $counter; ?>" enctype="multipart/form-data">
<tr>
<td><?php echo $row['name']; ?>
<input type="hidden" value = "<?php echo $row['projId']; ?>" name="projId"/>
</td>
<td><a href="#" name="btnDes">Design</a> | </td>
</tr>
</form>
<?php
$counter++;
}
java script
designBtn = document.getElementsByName("btnDes");
for (var i = 0; i < designBtn .length; i++) {
designBtn [i].id = i;
designBtn [i].onclick = fdesign;
}