When creating a popup in Elementor it can be given a button using the button widget for closing the popup. A simple link can also be created and JavaScript can be used to close it.
HTML and JavaScript
The following creates a simple link using the HTML a tag with a class of .close_sales_popup. Place this wherever you want the close link to appear.
Then the following can be placed in the head of the document or better yet linked to and placed in an external .js file. The second line of the script looks for the link with the class .close_sales_popup, and on click, closes the open popup.
jQuery(function($) {
$(document).on('click','.close_sales_popup', function(event) {
elementorProFrontend.modules.popup.closePopup( {}, event);
});
});
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
WordPress Books
All are affiliate links. Thank you for your support!
WORDPRESS NOTES:
- All modifications to a theme or plugin should be made by creating a child theme and placing the changes there; changes made to the parent theme will be overwritten the next time it updates
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.