Script working on Sandbox but to on live site

Hi
I’m experiencing something really strange. I have added a cookie script to a website, that works great on the webflow domain (sandbox), but not on the live site. Its for a pop up and the cookie stops the pop up from showing again if you close the modul.
https://www.butterflynetwork.com/popup-modal-test is the site.

Have anyone experienced anything similar?

Here is the script if that helps.

<!-- Cookie Script START -->
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script>
var cookieName = 'modalClosed';
if(typeof Cookies.get(cookieName) !== 'undefined') {
$('.modal-wrapper').remove();
}
$('.modal-close-button, .modal-success-close-btn').on('click', function(){
Cookies.set(cookieName, 'ok', { expires: 365 });
})
</script>
<!-- Cookie Script END -->

Sharing your live site URL would allow others to look into your problem.

Sorry. Here it is! https://www.butterflynetwork.com/popup-modal-test

The code is now in Google Tag Manager.