Any copy to clipboard plugin for blogger?


#1

Hey there everyone!

I am in the search for a copy to clipboard plugin for blogger.

if a user clicks on copy button then the text should be saved to the clipboard for pasting later

Does blogger support this functionality?

if so, how can I achieve this one?

thanks in advance SamaraSsr


#2

I have not used any clipboard plugin before but use this javascript

HTML Markup

<textarea id="getresult"></textarea>

JAVASCRIPT Code to Copy Function

    var copyTextareaBtn = document.querySelector('.js-textareacopybtn');

copyTextareaBtn.addEventListener('click', function(event) {
  var copyTextarea = document.getElementById("getresult");
  copyTextarea.select();

  try {
    var successful = document.execCommand('copy');
    var msg = successful ? 'successful' : 'unsuccessful';
    console.log('Copying text was ' + msg);
  } catch (err) {
    console.log('unable to copy');
  }
});

You check this working version here http://www.technohalf.com/p/blogger-code-converter.html