how can I copy the content of the element into the clipboard when I click on an element.
<h1 class="copy"> i want to copy this text on clipboard when I click on an element.</h1>
<p> i want to copy this text on clipboard<p>
Is it possible to copy without creating any element? Is there a solution similar to this?
$(function (){
$("h1").click(function (){
$(this).select();
document.execCommand("copy");
});
});
How can I do this with jquery or regular javascript. Or what are your other suggestions? Thanks