Skip to content

Instantly share code, notes, and snippets.

@dantetesta
Last active November 23, 2023 16:45
Show Gist options
  • Select an option

  • Save dantetesta/a5795c99b4f96a10807b41b3cad94289 to your computer and use it in GitHub Desktop.

Select an option

Save dantetesta/a5795c99b4f96a10807b41b3cad94289 to your computer and use it in GitHub Desktop.
/*BY: ASK JARVIS + DANTE TESTA */
/*
Coloque o name id do campo a ser copiado = 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('.elementor-field-group button').attr('type', 'button');
var conteudo = '#form-field-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