// The value to be copied
var valor = '{{code}}';
// Creates a temporary element to copy the value
var tempInput = document.createElement('input');
tempInput.value = valor;
document.body.appendChild(tempInput);
// Select and copy the value
tempInput.select();
document.execCommand('copy');
// Remove the temporary element
document.body.removeChild(tempInput);
// Displays the message "Copied!"
alert('Copiado!');