Answers for "how to copy from js the lines of an html"

0

how to copy from js the lines of an html

function copyToClipboard(element) {
  var $temp = $("<textarea>");
  var brRegex = /<br\s*[\/]?>/gi;
  $("body").append($temp);
  $temp.val($(element).html().replace(brRegex, "\r\n")).select();
  document.execCommand("copy");
  $temp.remove();
}

$( "#FailCopy" ).click(function() {
  alert("Well done! div #error-details has been copy to your clipboard, now paste it in the notepad or email!");
});
Posted by: Guest on July-20-2020

Code answers related to "how to copy from js the lines of an html"

Code answers related to "Javascript"

Browse Popular Code Answers by Language