navigator.clipboard.writeText not working on mobile

I have no idea why this doesn’t work:

js:

const copybutton = document.getElementById('copy');

copybutton.addEventListener('click', function(){

   copybutton.innerHTML = "[<i>email copied to clipboard</i>]";  
   navigator.clipboard.writeText("[email protected]");

}
)

html:

<button id="copy"> send a message</button>

All I managed to find is that it needs to be triggered by an event listener, which it definitely is. Works well on mobile. On mobile chrome it worked as an inline snippet but not when I made it into an event listener in a separate doc. Is the support bad for it?

(project uses JQuery as well, if that helps.)