1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <div style=" text-align:center;">
<button type="button" id="addNewEntryButton" >Ajouter une ligne</button><BR>
Veuillez cliquer au moins une fois sur ce bouton.
<table style="margin-left:200px" id="ajout">
<thead>
<tr>
<th style="border: 1px solid black;">Sous-lieu de la zone</th>
<th style="border: 1px solid black;">Anomalies</th>
<th style="border: 1px solid black;">Photos</th>
</tr>
</thead>
<tbody>
<!-- Contenu dynamique du tableau -->
</tbody>
</table>
<script>
const addNewEntryButton = document.getElementById("addNewEntryButton")
const tableTbody = document.querySelector("#ajout tbody")
addNewEntryButton.onclick = () => {
const entryNumber = tableTbody.childElementCount
const tr = document.createElement("tr")
tr.innerHTML =
`<td><textarea required style="width: 250px; text-align:center; margin:auto;
height: 20px;" name="lieu[${entryNumber}]" rows="4" cols="40" placeholder="sous-lieu n°${entryNumber}"></textarea></td>` +
`<td><textarea style="width: 250px; margin:auto;
height: 20px;" name="ano[${entryNumber}]" rows="4" cols="40"placeholder="anomalie n°${entryNumber}"></textarea></td>` +
`<td><input style="width: 250px; margin:auto;
height: 20px;" name="fichier${entryNumber}[]" type="file" placeholder="oii" multiple><br></textarea></td>`
tableTbody.appendChild(tr)
}
</script> |
Partager