Can you help me with this issue? I have a navigation bar with an item called "Author" that shows author information in a dropdown when clicked. The problem is that the dropdown is clickable, causing it to disappear. I want it to only show and close within the navigation bar itself.
<div id = 'Author' class = 'navbarItem'>Author
<div id = 'authorInfo'>
// info about author
</div>
const author = document.getElementById('Author');
const authorInfo = document.getElementById('authorInfo');
author.onclick = () => {
if(authorInfo.style.display == 'none' || authorInfo.style.display== '')
authorInfo.style.display = 'block'
else
authorInfo.style.display = 'none';
}
I've attempted setting the onclick event of authorInfo to null, but that doesn't solve the issue.