[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:

Click to Copy ↗  
Nein, danke

function ImportVoucher(element) {
    $('input[type=p2]').click(function(ev) {

added id to Voucher field.


Everything works fine, exept the add Voucher itself.


If someone could assist.