i have a table i need if i click on any cell copy it to clipboard using jquery
or javascript
i tried to put the same id to every td and if i click to this element copy it but i cant do it
<table id="myTable">
<thead>
<tr class="table100-head">
<th class="column1">id</th>
<th class="column2">user</th>
<th class="column3">pass</th>
</tr>
</thead>
<tbody>
<tr>
<td id="copyte" class="column1">1</td>
<td id="copyte" class="column2">admino</td>
<td id="copyte" class="column3">123456</td>
</tr>
<tr>
<td id="copyte" class="column1">2</td>
<td id="copyte" class="column2">aa</td>
<td id="copyte" class="column3">123456</td>
</tr>
<tr>
<td id="copyte" class="column1">3</td>
<td id="copyte" class="column2">bb</td>
<td id="copyte" class="column3">123456</td>
</tr>
</tbody>
</table>
jquery
$(document).ready(function() {
$('[id^="copyte"]').click(function(e) {
alert(1);
});
});
Is there a better idea or solution?