javascript - ZeroClipboard issue -
i trying copy link of current page using zeroclipboard , don't know further. code until now. how can copy link?
function copylink() { document.getelementbyid("copy").value += window.location.href; var link = document.getelementbyid("copy").value; var client = new zeroclipboard(); client.settext(link); }
<script src="https://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.2.0/zeroclipboard.core.min.js"></script> <html> <head> <title>copy</title> </head> <body> <div> <button id="copybtn" onclick="copylink()">copy link</button> <textarea id="copy" style="display: none;"></textarea> </div> </body> </html>
thanks !
Comments
Post a Comment