So I am using a MacBook and I have a copy button that copies a generated text input on a text field.
This is the code:
document.querySelector("#btnCopy").addEventListener('click', copy);
async function copy(){
var text = document.querySelector("#docNumber");
text.select();
navigator.clipboard.writeText(text.value)
}
When I check the clipboard nothing has been copied.
Any suggestion of what is going on?
Thanks, community.