How To Make Coupon Code Web Design | Click To Copy Coupon Using HTML CSS JavaScript

PHOTO EMBED

Fri Dec 31 2021 16:05:13 GMT+0000 (UTC)

Saved by @aibaljose #html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>

<body>
    <div class="container">
        <div class="coupon-card">
            <img src="google.png" alt="" class="logo">
            <h3>20% Flat off on all ride with in the city using <br> HDFC Credit Card </h>

                <div class="coupon-row">
                    <span id="cpncode">STEALDEAL20</span>
                    <span id="cpnbtn">Copy CODE</span>
                </div>
                <p>Valid Till:20-11-2022</p>
                <div class="circle1"></div>
                <div class="circle2"></div>

        </div>
    </div>
    <script>
        var cpnbtn = document.getElementById("cpnbtn")
        var cpncode = document.getElementById("cpncode")
        
        
        cpnbtn.onclick = function(){
            navigator.clipboard.writeText(cpncode.innerHTML);
            cpnbtn.innerHTML = "COPIED";
            setTimeout(function(){
                cpnbtn.innerHTML = "COPY";
        
            }, 3000); 
        }
    </script>
</body>

</html>
content_copyCOPY