Skip to content

Instantly share code, notes, and snippets.

@dantetesta
Last active May 25, 2022 12:03
Show Gist options
  • Save dantetesta/b7b9b4d4e26e89859b1e6d28424fb4ae to your computer and use it in GitHub Desktop.
Save dantetesta/b7b9b4d4e26e89859b1e6d28424fb4ae to your computer and use it in GitHub Desktop.
/*BY: ASK JARVIS + DANTE TESTA */
/*
Coloque o name id do campo que deseja copiar = 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(){
var btn = jQuery('.jet-form__submit-wrap button').attr('type', 'button');
var conteudo = '#conteudo';
/*FUNÇÃO QUE COPIA*/
jQuery(btn).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(btn).text('Copiar');
jQuery(btn).css('background-color','#EF6909');
jQuery(btn).css('color','white');
},3000);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment