JSFiddle - React, Tailwind, and code Playground
HTML
<form name="form2" method="post" action="">
<table id="idTable" align="center">
</table>
</form>
JavaScript
window.insererLigne_Fin = function(idCurrent)
{
var cell, ligne;
// je récupère l'identifiant (id) de la table qui sera modifiée
var tableau = document.getElementById("idTable");
var nbLignes = tableau.rows.length;
ligne = tableau.insertRow(-1); // ici création d'une ligne pour ajout en fin de table
var newId = "sizepopulation"+nbLignes;
cell = ligne.insertCell(0);
cell.innerHTML = " <textarea name='sizepopulation' id='"+ newId +"' rows='1' cols='15' ></textarea>";
cell = ligne.insertCell(1);
cell.innerHTML = '<input type="button" name="add" value="Add" onclick="insererLigne_Fin(\''+ newId +'\')"" />';
if (idCurrent)
{
var currentCellValue = document.getElementById(idCurrent).value;
alert('valeur du textarea courant :' + currentCellValue);
}
}
insererLigne_Fin();