jquerypaypalpaypal-buttons

PayPal smart button won't submit with dynamic values


I have a PayPal smart button that looks like this:

enter image description here

The button div is hidden but exists on the page, then after the user makes some choices, the value are populated and the button div is shown.

The problem is that when the user clicks one of the pay button, nothing happens and no errors are generated.

I if manually click in each input field and tab through them, the buttons work.

I'm not sure what's happening. I tried something like this to simulate moving to each input:

                    $("#smart-button-container").find("input").each(function(){
                            $(this).focus();
                    });

but that doesn't work.

How can I make it work?

JSfiddle


Solution

  • The problem is you start with a default of:

          onInit: function (data, actions) {
            actions.disable();
    

    Which only changes after there is a keyup event.