as you would have guessed from my question and as you will interpret by looking at my code , im a beginner. this is the first real application i tried to write in javascript and i would love to understand why it doesn't work?
var button = document.getElementById("button");
var text = document.getElementById("text");
function button() {
text.select();
text.setSelectionRange(0, 99999);
navigator.clipboard.writeText(text.value);
alert("you copied this text");
}
button is a onclick event in html and text is an input in html. thank you very much
clipboardAPI. But note: "The navigator.clipboard API is a recent addition to the specification and may not be fully implemented in all browsers. This article describes some limitations, but be sure to review the compatibility tables for each method before using them to ensure that the API supports your needs."buttonactually called? Also,writeTextreturns aPromise, so thealertcall does not actually tell you if the clipboard was written to. What browser are you using, and version? The Clipboard API is still pretty new.