-2

how to create this type of code, if you click in get code button, you will redirect to another tab of the eCommerce store and coupon code will appear after you click on it.

enter image description here

Gynteniuxas
  • 7,035
  • 18
  • 38
  • 54

3 Answers3

2

Html

// use button 
<button onclick="Redirectpage()">Coupon Code</button>

// use Img 
<img src="" onclick="Redirectpage()"/>

Javascript

function Redirectpage() {
    location.href = "Put Your website here;
}
Zulu
  • 8,765
  • 9
  • 49
  • 56
Sumit patel
  • 3,807
  • 9
  • 34
  • 61
0
<a href="<your new link here>" target="_blank" class="coupon_code">Coupon Code</a>

In your javascript code

$(document).ready(function(){
    $(".coupon_code").click(function(){

       // place your javascript code for open popup of coupon code

       return true; // it will redirect to href link in new tab
    });
});
Haresh Vidja
  • 8,340
  • 3
  • 25
  • 42
0

Try this one;

$('button').on('click',function()({

   `$(this).html('your coupon code here');`
   ` window.open('https://link.com', '_blank');

});

Kallol Pratim
  • 56
  • 1
  • 9