Add functionality to ajax_add_to_cart button in woocommerce to close a custom modal after item was added to cart

Im trying to close a modal with javascript (doesnt matter if its with js or jquery or php), I’ve tried adding custom JS with a button pointer like this:

<script type="text/javascript">
(function($){
   $('.btn[data-product_id='11068651']').click( function(){
      document.querySelector(".speak-up-modal").style.display = "none";
   });
   $('.btn[data-product_id='11068652']').click( function(){
      document.querySelector(".speak-up-modal").style.display = "none";
   });
})(jQuery);
</script>

And add this to the wp_footer this way:

add_action( 'wp_footer', 'single_add_to_cart_event_button_function' );
function single_add_to_cart_event_button_function() {
    ?>
        <script type="text/javascript">
            (function($){
                $('.btn[data-product_id='11068651']').click( function(){
                    document.querySelector(".speak-up-modal").style.display = "none";
                });
                $('.btn[data-product_id='11068652']').click( function(){
                    document.querySelector(".speak-up-modal").style.display = "none";
                });
            })(jQuery);
        </script>
    <?php
}

But nothing works, this is how Im using the woocommerce buttons in the modal:

<a href="#" class="button add_to_cart_button ajax_add_to_cart btn" data-product_id="11068652" data-quantity="1" rel="nofollow">

And nothing I do adds the event to the button, any chance for some help in modifying/adding functionality to this button?

This is what I’ve tried:
Button:

<a href="#" class="button add_to_cart_button ajax_add_to_cart btn" data-product_id="11068652" data-quantity="1" rel="nofollow">

Inside the JS in footer itself where I initiate the modal

<script type="text/javascript">
(function($){
   $('.btn[data-product_id='11068651']').click( function(){
      document.querySelector(".speak-up-modal").style.display = "none";
   });
   $('.btn[data-product_id='11068652']').click( function(){
      document.querySelector(".speak-up-modal").style.display = "none";
   });
})(jQuery);
</script>

And in functions.php:

add_action( 'wp_footer', 'single_add_to_cart_event_button_function' );
function single_add_to_cart_event_button_function() {
    ?>
        <script type="text/javascript">
            (function($){
                $('.btn[data-product_id='11068651']').click( function(){
                    document.querySelector(".speak-up-modal").style.display = "none";
                });
                $('.btn[data-product_id='11068652']').click( function(){
                    document.querySelector(".speak-up-modal").style.display = "none";
                });
            })(jQuery);
        </script>
    <?php
}