rrr
3 years ago in HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<center>
<p id="promocode">KJF934MJX</p>
<button onclick="copyToClipboard('#promocode')">Copiar el codi</button>
</center>
<script type="text/javascript">
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
alert("Copied the text");
}
</script>