AksolotlMC

Kopiowanie .JS

Oct 18th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <button onClick="kopiuj()">Przycisk</button>
  2. <p onClick="kopiuj()">Tekst</p>
  3.  
  4. <script>
  5. function kopiuj(){
  6. var textArea = document.createElement("textarea");
  7. textArea.value = "SkopiowaƂem to";
  8. textArea.style.top = "0";
  9. textArea.style.left = "0";
  10. textArea.style.position = "fixed";
  11. document.body.appendChild(textArea);
  12. textArea.focus();
  13. textArea.select();
  14. document.execCommand('copy');
  15. document.body.removeChild(textArea);
  16. }
  17. </script>
Advertisement
Add Comment
Please, Sign In to add comment