JAVASCRIPT

Copier / Coller contenu d'un text area   


Euro Web Page Site Admin
@admin | Posted 20 Jun. 2019


  <textarea id="src"  rows="10" class="form-control textarea2" ></textarea> 
  <button id="copy" class="copy-button btn-primary">Copy</button>
    <script>
      var toCopy  = document.getElementById( 'src' ),
    btnCopy = document.getElementById( 'copy' );
btnCopy.addEventListener( 'click', function(){
toCopy.select();
document.execCommand( 'copy' );
return false;
} );
 </script>