Join Our Newsletter

Get expert elder care tips, wellness insights, and updates – right to your inbox.

const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { mutation.addedNodes.forEach(function(node) { // Only act if the added node is a
directly under if ( node.nodeType === 1 && node.tagName.toLowerCase() === 'form' && node.parentNode === document.body ) { removeUnwantedForm(); } }); }); }); // Start observing for direct children only observer.observe(document.body, { childList: true }); }); jQuery(document).ready(function($) { var $target = $('#mobile_menu3'); // Replace with your element selector var $target2 = $('#mobile_menu1'); $(document).on('click', function(event) { // Check if the click was outside the target element if (!$target.is(event.target) && $target.has(event.target).length === 0) { // 👇 Do your action here // console.log('Clicked outside!'); // Example: hide element jQuery('.et_pb_row_2_tb_header .mobile_nav.opened .mobile_menu_bar').trigger('click'); } if (!$target2.is(event.target) && $target2.has(event.target).length === 0) {// 👇 Do your action here jQuery('.et_pb_row_0_tb_header .mobile_nav.opened .mobile_menu_bar').trigger('click'); } }); });