Javascript Code to Copy Text to Clipboard

PHOTO EMBED

Saved by @mishka #javascript

function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();

}
content_copyCOPY

This function uses jQuery. But beware it does not copy line breaks in the copied text.

https://codepen.io/shaikmaqsood/pen/XmydxJ