Hello Ghada,
you can try the following instead.
This way the attribute onclick is not needed.
CSS classes are not removed automatically.
The subsequent javascript would then have to be placed in the template's custom.js.
This code would then have to be placed in a DOMready.
If you still need help, please let me know.
let copyTextElements = document.querySelectorAll('.copyText');
for( let copyTextIndex in copyTextElements ) {
if( copyTextElements.hasOwnProperty(copyTextIndex) ){
copyTextElements[copyTextIndex].addEventListener('click',copyText);
}
}
Have a nice day.