#my codes

  
  
 
<div class="copy-box">
    <span class="copy-text">This is the text to copy</span>
    <button class="copy-btn">Copy</button>
</div>

  
  

.copy-box {
    position: relative;
    padding: 15px;
    background: #f4f4f4;
    border-left: 4px solid #007bff;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 5px;
}

.copy-box:hover {
    background: #eaeaea;
}

.copy-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.copy-btn:hover {
    background: #0056b3;
}


<script>

document.addEventListener("DOMContentLoaded", function () {

    document.querySelectorAll(".copy-box").forEach(function (box) {

        box.addEventListener("click", function () {

            let textToCopy = box.querySelector(".copy-text").innerText.trim();

            let tempInput = document.createElement("textarea");

            tempInput.value = textToCopy;

            document.body.appendChild(tempInput);

            tempInput.select();

            document.execCommand("copy");

            document.body.removeChild(tempInput);

            

            // Change button text temporarily to show confirmation

            let btn = box.querySelector(".copy-btn");

            btn.innerText = "Copied!";

            setTimeout(() => btn.innerText = "Copy", 1500);

        });

    });

});

</script>

[JSON] escaped_code_here