'Elementor Popup need close and do not show again by javascript
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();
} );
} );
Solution 1:[1]
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 );
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ab Rasel |
