Click button copy to clipboard using jQuery

前端 未结 21 2083
醉话见心
醉话见心 2020-11-21 23:11

How do I copy the text inside a div to the clipboard? I have a div and need to add a link which will add the text to the clipboard. Is there a solution for this?

         


        
21条回答
  •  长情又很酷
    2020-11-22 00:01

    The text to copy is in text input,like: and, on button click above text should get copied to clipboard,so button is like: Your script should be like:

    
    

    For CDN files

    • (zeroclipboard.swf):
    • (zeroclipboard.js):

    note: ZeroClipboard.swf and ZeroClipboard.js" file should be in the same folder as your file using this functionality is, OR you have to include like we include on our pages.

提交回复
热议问题