I have a copy button script:
function myFunction() {
var table = document.getElementById('myTable');
var copyText = table.rows[1].cells[0].innerHTML;
copyText.select();
document.execCommand("copy");
alert("Copied");
}
And my table:
<table id="myTable">
{% for resp in results %}
<tr>
<td>{{ resp }}</td>
<td>{{ resp.Question_id.Statement }}</td>
<td><button onclick="myFunction()">Copy text</button></td>
</tr>
{% endfor %}
</table>
I want the button to copy the text inside td {{ resp }} /td