INNER CODE UNIT · JavaScript

copyToClipboard

DinoChiesa/jwt-webtool · src/js/app.js:374

function copyToClipboard(event) {
  const sourceElement = event.currentTarget.getAttribute("data-target"),
    $source = document.getElementById(sourceElement),
    $temp = document.createElement("textarea");

  if (editors[sourceElement]) {
    editors[sourceElement].save();
  }

  gtag("event", "copyToClipboard", {
    event_category: "click",
    event_label: sourceElement,
  });

  const sourceType = $source.tagName;
  const textToCopy =
    sourceType == "TEXTAREA" || sourceType == "INPUT"
      ? $source.value

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…