No title

0
<!DOCTYPE html>
<html>
<head>
  <style>
    .code-box {
      background-color: black;
      color: white;
      padding: 10px;
      font-weight: bold;
    }

    .copy-button {
      background-color: green;
      color: white;
      border: none;
      padding: 5px 10px;
      cursor: pointer;
      font-weight: bold;
    }
  </style>
</head>
<body>
  <button class="copy-button" onclick="copyCode()">Copy to Clipboard</button>
  <div class="code-box">
    Your code text here
  </div>

  <script>
    function copyCode() {
      const codeBox = document.querySelector('.code-box');
      const codeText = codeBox.textContent;
      navigator.clipboard.writeText(codeText)
        .then(() => {
          alert('Code copied to clipboard!');
        })
        .catch(err => {
          console.error('Failed to copy code:', err);
        });
    }
  </script>
</body>
</html>

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

buttons=(Accept !) days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !