I already have code that closes Elementor 2 popup by one button, but can't make save it in cookie sessions to not show a second time when site loading, this is for cookie police popup.
jQuery( document ).ready( function( $ ) {
$( document ).on( 'click', '.close-popup', function( event ) {
$( "#elementor-popup-modal-4874 .dialog-close-button" ).click();
$( "#elementor-popup-modal-4877 .dialog-close-button" ).click();
} );
} );
You can try this
var subsc_cookie = $.cookie('emailSubcribeModal');
if(subsc_cookie != 'closed'){
$( "#elementor-popup-modal-4874 .dialog-close-button" ).show();
$( "#elementor-popup-modal-4877 .dialog-close-button" ).show();
}
$('.close-popup').on('click', function(){
$( "#elementor-popup-modal-4874 .dialog-close-button" ).hide();
$( "#elementor-popup-modal-4877 .dialog-close-button" ).hide();
document.cookie = "emailSubcribeModal=closed;";
setCookie("emailSubcribeModal", "closed", 3 );
})