[Popup] Submit Voucher onlclick

So i am trying to figure out this one couple days already… The idea was the make exit-popup button which would upon click add Vouch code (Discount) into cart.

(First the idea was to copy it)

What i have done sofar:

    FREE16
      
Click to Copy ↗  
Nein, danke


function ImportVoucher(element) {
    
    $('input[type=p2]').click(function(ev) {
    ev.preventDefault();
    $(this).siblings('input[type=p2]').removeClass('selected');
    $(this).addClass('selected');
    $('#sVoucher').val($('.selected').val());
    $temp.remove();
}

added id to Voucher field.

 

Everything works fine, exept the add Voucher itself.

 

If someone could assist.