84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
How do I create a function that copies text to the clipboard? I found on w3schools how to do it using an input box, but I don't know how to do it using just text (like Hypixel for example)
You don't need to use a library to accomplish this.Just usedocument.execCommand("copy")
document.execCommand("copy")
$("#txt").on("click", function (event) { var $temp = $(""); $("body").append($temp); $temp.val($("#txt").html()).select(); document.execCommand("copy"); $temp.remove(); });
复制这段文字
You don't need to use a library to accomplish this.
Just use
document.execCommand("copy")