Need your Elementor popup menu to close automatically when someone clicks a link inside it? In this tutorial, I’ll show you exactly how I solved that problem with a simple custom script. By default, Elementor’s popups are great for mobile menus and call-to-action panels, but they can feel clunky when the popup stays open after a user chooses a menu item.
In this post, we’ll walk through the logic behind closing the popup on link click, look at the code I used, and see how you can adapt it to your own layout. You’ll learn where to place the code, how it interacts with Elementor’s popup settings, and how to make sure it works smoothly on both desktop and mobile.
Whether you’re building a fullscreen mobile menu or a small popup navigation, this quick tweak will make your site feel more polished and user-friendly — no extra plugins required.
<script>
jQuery(function($){
$(document).on(‘click’,’.elementor-location-popup a’, function(event){
elementorProFrontend.modules.popup.closePopup( {}, event);
});
});
</script>
