Share excellent template plug-in resources
Current position: home page > Website Design >Hidden js code that automatically copies content to the clipboard

Hidden js code that automatically copies content to the clipboard

Author: blueleaf Classification: Website Design Time: February 5, 2021 Browse: 3079

A string of practical Js code The hidden js code that automatically copies the content to the clipboard. After the page deploys the auto copy content code, the content will be automatically copied to the clipboard as long as the user clicks on the computer or mobile phone, and the promotion and sharing code will be copied secretly. The practical js code is very simple to use, and only needs to copy the code to the page Template , can be used with slight modifications.

 <script src=" https://cdnjs.cat.net/ajax/libs/ jquery /3.3.1/jquery.min.js"></script> <script src=" https://cdnjs.cat.net/ajax/libs/clipboard.js/1.7.1/clipboard.min.js "></script> <script> $("body").onclick = copycode(); $("body").attr("id" ,"copy"); $("body"). attr ("data clipboard text", "content to be copied"); function copycode(){var clipboard = new Clipboard('#copy');clipboard.on('success', function (e){console.log("copy ok");}); clipboard.on('error', function (e){console.log("copy error");});} </script>

Disclaimer:

Website: Click Copy to share with friends!

All content resources shared by this website, if not noted, are original by Blueleaf. If you need to reprint, please indicate the source; Please contact us in case of infringement Contact handling Please understand!

Comment List
 blink the eyes kiss Growl happy think poor It's embarrassing Grievance ha-ha hush Right hum Zuo Hum Hum doubt A bad laugh Make money Sadness Be cool Seduce fierce handshake yeah Hee hee Shyness applause greedy Madness Embrace gather and watch Mighty awesome
Submit comments

Clear information
Close Comment
music appreciation