0

I have a checkout button, and when the user accepts the terms, in the first event I set the button to disable and then submit the form. In this case, the second event that was set on the button won't fire anymore.

$cache.opcSubmit.prop('disabled', true);
$cache.opc.submit();

first event regular one

the second (live) event will not fire when that code above runs that is in the first event.

The second event was set like this :

$(document).on('click', '.continue-step button[type="submit"]', function () {
    $(this).data('event', 'doSomething');
}

The thing is that I cannot place the second event up because it is using a library that it will init events after 1 second to be sure was loaded.

Any help or suggestion would be appreciated. Thanks

Community
  • 1
  • 1
123onetwothree
  • 636
  • 1
  • 8
  • 17
  • Does the order of the events matter? Can you run yours first? The following discusses how to attach an event as the first event. https://stackoverflow.com/questions/4742610/attaching-jquery-event-handlers-so-that-they-are-triggered-first – Stephen Hewison Dec 17 '18 at 11:41
  • As i told in the question i cannot do that because the events are inited after 1 second `setInterval(initializeTracking, 1000);` so it will always get second due to library loading – 123onetwothree Dec 17 '18 at 11:44
  • You can set your own interval and only attach your event after the library has finished loading. – Stephen Hewison Dec 17 '18 at 11:51
  • @cse it does nothing that blocks . this doent even fire .. that is the problem – 123onetwothree Dec 17 '18 at 16:04

0 Answers0