Use the navigator.clipboard API to copy any text with a single click. It requires HTTPS.
<button class="lotgrafix-copy" data-copy="Text to copy">Copy</button>
main.js
document.addEventListener( 'click', function ( e ) {
var btn = e.target.closest( '.lotgrafix-copy' );
if ( ! btn ) {
return;
}
navigator.clipboard.writeText( btn.dataset.copy ).then( function () {
btn.textContent = 'Copied!';
setTimeout( function () {
btn.textContent = 'Copy';
}, 2000 );
} );
} );