document.getElementById('pageActionTriggerMobile').addEventListener('click', function() { var targetDiv = document.getElementById('pageActionTriggerMobileTarget'); var innerElement = this.querySelector('*'); // Selects the first child element of the clicked element // Toggle the display property of the target div if (targetDiv.style.display === 'none' || targetDiv.style.display === '') { targetDiv.style.display = 'flex'; innerElement.style.transform = 'rotate(180deg)'; } else { targetDiv.style.display = 'none'; innerElement.style.transform = 'rotate(0deg)'; } });