How to make coupon code reveal for more than one coupon

Codes here !

Moderators: egami, macek, gesf

Post Reply
ShobhaPatwal96
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Oct 29, 2018 2:35 am

Wed Oct 16, 2019 3:40 am

Code: Select all

<div class="get-codebtn-holder"><div class="offer-get-code-link cpnbtn"> 
    <span class="code coupon-code">TRY2GO</span>
    <a class="peel-btn btn-coupon">Show Coupon</a>
 	</div></div>
 	<div class="get-codebtn-holder"><div class="offer-get-code-link cpnbtn"> 
    <span class="code coupon-code">TRY2GO</span>
    <a class="peel-btn btn-coupon">Show Coupon</a>
 	</div></div>
 	 <script>
  var btn = document.getElementsByClassName("btn-coupon"); 
      for (var i = 0; i < btn.length; i++) {
    
    // Define the onclick event on popup's btn

    btn[i].onclick = function(){
    	 // Get the popup associated to the btn with the data-popup-id
    	var coupon = document.getElementsByClassName("coupon-code");
    	 for (var j = 0; j < coupon.length; j++) {  
    	 var coupon1=coupon[i].innerHTML;
    	 } 
    this.innerHTML = coupon1;
     $(".coupon-code").hide();
  };
  }
  </script>
Post Reply