You can try this .. maybe it will help you..
copy text by hover from table cell..
document.querySelectorAll(".table-cell").forEach(function(elm){
elm.addEventListener("mouseover", function(e){
e.target.style.backgroundColor = 'red';
var copyText = e.target.textContent;
const el = document.createElement('textarea');
el.value = copyText;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
/* Alert the copied text */
alert("Copied the text: "
…
Top comments (0)