Last active
May 25, 2022 12:03
-
-
Save dantetesta/f28ac630416ffdfec29ae28b3fbf8d39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*BY: ASK JARVIS + DANTE TESTA */ | |
/* | |
Declare o #conteudo no campo a ser copiado | |
Declare o #copiar no botão que ao ser clicado vai copiar o conteúdo do campo #conteudo | |
*/ | |
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> | |
<script> | |
jQuery(document).ready(function(){ | |
jQuery('.copiar').click(function(){ | |
jQuery('.conteudo').select(); | |
document.execCommand('copy'); | |
jQuery(this).text('Copiado!'); | |
jQuery(this).css('background-color','black'); | |
jQuery(this).css('color','white'); | |
setTimeout(function(){ | |
jQuery('.copiar').text('Copiar'); | |
jQuery('.copiar').css('background-color','#EF6909'); | |
jQuery('.copiar').css('color','white'); | |
},3000); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment