Forum Moderators: open
<div class="btn btn-primary" id="coupon_code_container_<?php echo $couponvalue['id'];?>" >
<strong code="<?php echo $couponvalue['id'];?>" id="coupon_code_<?php echo $couponvalue['id'];?>" data-clipboard-text="<?php echo $couponvalue['couponcode'];?>" class="copyCoupon">GET COUPON CODE</strong>
</div> <script type="text/javascript">
$('strong').click(function(){
var join = location.href.match(/\?/)?'&':'?';
var newtab = window.open(location.href +join+'code='+this.getAttribute('code'),'_blank');
//var newtab = window.open(location.href +'#'+this.getAttribute('code'),'_blank');
window.location.href = "/opensite.php?store="+this.getAttribute('code');
newtab.focus();
});
var code = /code=(\d+)/.exec(window.location.search)[1];
if (code){
coupon_code = $('strong[code='+code+']').attr('data-clipboard-text');
$('strong[code='+code+']').html(coupon_code);
$('#myModal').modal('show');
$('#myModal #coupon_code').val(coupon_code);
$('#myModal .copy_coupon').attr('data-clipboard-text',coupon_code);
var client = new ZeroClipboard($('.copy_coupon'));
client.on( "aftercopy", function( event ) {
$('#myModal .copy_coupon').html('COUPON COPIED');
});
}
</script> var join = location.href.match(/\?/)?'&':'?';
var newtab = window.open(location.href +join+'code='+this.getAttribute('code'),'_blank');
//var newtab = window.open(location.href +'#'+this.getAttribute('code'),'_blank'); var join = location.href.match(/\?/)?'&':'?';
var newtab = window.open(location.href +join+'code='+this.getAttribute('code'),'_blank'); \d* where I'd use * instead of + just to protect against the parameter being defined-but-empty.