Skip to content
Advertisement

Bootstrap toggler doesn’t hide

I am making a website using Bootstrap 5. The navbar can show the navigation when it is in a responsive viewport and I click the toggler icon, but doesn’t hide if I click it again. Looking inside the developer tools I see that the class show is still present.

My html navbar:

JavaScript

The Bootstrap scripts:

JavaScript

The status of toggler before click:

JavaScript

The status after click:

JavaScript

After I click it again it doesn’t hide the nav.

Advertisement

Answer

Here, Nothing wrong in your code. & it is working fine. but, You are added both Bundle & Separate bootstrap script. You will need to add any one from both.

Bundle:

JavaScript

Otherwise:

Separate:

JavaScript

Please read bootstrap docs here for more details.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement