simple click - The best X5 website demo by AF Software

WSX5 Demo
May 2024
       (c)

(Not responsive) - Created with Pro v2024.1.8
Drop me an email
WSX5 Pro- Help by Users
Aller au contenu
Copier un texte par un simple clique souris


Vous ajoutez le code HTML suivant dans un objet HTML pour copier le texte inscrit dans cet objet HTML par un simple clique souris



Le code est le suivant


<div id="text">AF Software: this text will be copied by clicking on the button</div>
<br>
<button id="copy">▲ Copy the text </button>
<script>
$('#copy').click(function() {   
 var $temp = $("<input>");    
 $("body").append($temp);    
 $temp.val($('#text').text()).select();   
 document.execCommand("copy");   
 $temp.remove();    
 $(this).text('Copied text into your clipboard!');
 });   
</script>


                      Et cela donne
AF Software: this text will be copied by clicking on the button

Retourner au contenu