0

This is my coding i was tried to copy table td text when onclick td using jquery... i got the value of child td is fine. but i cann't copy that word into clip board using .select() and execCommand("copy")..here is my jquery code

$('.copytd').on("click",function(e) {
  var copyText = $(this).closest('tr').find(".cpy").text();
  copyText.select();
  document.execCommand("copy");
  alert("copied Text:"+copyText);
 });

and my table td is

 <td align="center" ><span class = 'cpy'><?echo $row['ipno'];?></span> <span class="copytd text-primary"> Copy</span> </td>

then i have changed my text as copied before copy the text

Jeya kumar G
  • 85
  • 1
  • 7

0 Answers0