Below is JS Code
document.addEventListener("DOMContentLoaded,");
const toggleBtn = document.getElementById('toggle_btn');
const dropDownMenu = document.getElementById('dropdown_menu');
toggleBtn.onclick = function(){
dropDownMenu.classList.toggle('open');
}
I want the dropdown menu to get toggled when clicked in the responsive design
2
Answers
It seems like you are trying to toggle the visibility of a dropdown menu when a button is clicked. The code you provided looks correct but i rewrote it so it should work:
Or you can use jQuery to toggle the visibility of the element with the "toggle" method:
try it….. 😊