2021-11-28

Copy to Clipboard element's text value using jQuery

Edit: I do not try to copy textarea or input value so it is not a duplicate question as suggested.

Can I use copy to clipboard for an element's text value?

Such as I want to copy terra1

<span id="terra-wallet-address">terra1</span>

And jQuery:

  jQuery('#terra-wallet-address').focus();
  jQuery('#terra-wallet-address').select();
  document.execCommand('copy');
  jQuery('.copied').text("Copied to clipboard").show().fadeOut(1200);

I also tried .val() and .text() but did not work.

Thank you.



from Recent Questions - Stack Overflow https://ift.tt/3nZ2aSN
https://ift.tt/eA8V8J

1 comment:

  1. How To Clone Or Duplicate Html Element Using Jquery

    Learn how to clone or duplicate html element using jquery.

    For More Info:- How To Clone Or Duplicate Html Element Using Jquery

    ReplyDelete