Guest User

Untitled

a guest
Nov 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //copy to clipboard
  2. $(document).on('click', '[data-action=copy]', function (){
  3. /* Create input */
  4. $('[data-action=copy]').after('<input class="hide" value="'+$(this).attr("data-url")+'" id="share-url">');
  5.  
  6. /* Get the text field */
  7. var copyText = document.getElementById("share-url");
  8.  
  9. /* Select the text field */
  10. copyText.select();
  11.  
  12. /* Copy the text inside the text field */
  13. document.execCommand("copy");
  14.  
  15. /* Alert the copied text */
  16. alert("copied");
  17. });
  18.  
  19. <a data-action="copy" data-url="{{$whatext.'s=link'}}" href="#">
  20. <img src="{{ cdn('/img/social/link.png') }}" >
  21. </a>
Add Comment
Please, Sign In to add comment