The latest version of Bootstrap 5 [beta] has removed jQuery, causing issues with the hamburger menu functionality not opening or collapsing properly

Recently, I decided to experiment with the latest Bootstrap version 5 beta after successfully implementing a hamburger menu in v4.6. However, upon testing v5, I encountered two immediate changes:

  • The removal of jQuery
  • Replacing ml-auto with ms-auto

Despite these changes, the functionality of the hamburger menu was altered in v5—it no longer opened or collapsed as expected. Could there be other changes between Bootstrap v4 and v5 that I overlooked? Is there perhaps an unknown Vanilla JS replacement for previously used jQuery that enables the hamburger functionality?

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  
  <body>
    <div class="container-fluid">
    
        <nav class="navbar navbar-dark navbar-expand-sm" style="background-color: #039;">
        <a class="navbar-brand" href="#">
            <img src="/img/test.png" class="d-inline-block align-middle" alt="image brand"> Image brand
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="collapsibleNavbar">
            <ul class="navbar-nav ms-auto">
                <li class="nav-item">
                    <a class="nav-link" href="#">Register</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Login</a>
                </li>
            </ul>
        </div>  
        </nav>

        <div class="row">
            <div class="col-sm-12"><hr style="margin-bottom:10px; margin-top:10px; " /></div>
        </div>

        <div class="row">
            <div class="col-sm-4" style="background-color:lavender;">1st col</div>
            <div class="col-sm-4" style="background-color:lavenderblush;">2nd col</div>
            <div class="col-sm-4" style="background-color:lavender;">3rd col</div>
        </div>

        <div class="row"> 
            <div class="col-sm-12 small"></div>
        </div>

    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>

  </body>
</html>

Answer №1

Oh, interesting:

New data attributes: data-bs-toggle data-bs-target

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am facing an issue with my middleware setup. It functions correctly when I include it in my app.js file, but for some reason, it does not work when I add it to my server.js file

Displayed below is my App.js information: const express = require("express"); const dotenv = require("dotenv"); const movieRouter = require("./routes/movieRoutes"); const userRouter = require("./routes/userRoutes"); ...

What is the best way to utilize AJAX for displaying data within a div element?

I am struggling with integrating two files - index.php and process.php. In my index.php file, there is a form that submits to process.php: <form class="form" action="process.php" method="POST" name="checkaddress" id="checkaddress"> <table> ...

Can a SVG Animation be created featuring a progress ring with both the right and left dash offsets moving simultaneously?

Currently in my codepen, I am working on a project where I am using GSAP. If you are unfamiliar with that, no worries - just focus on the dashoffset and dasharray in the SVG circulation path. You can find this project in Codepen which is part of our premi ...

unable to load()

I am currently in the process of converting frames to div elements. My approach involves using jQuery's load() method, but I have encountered an error that has me stumped. The code snippet below is where the issue resides. Any assistance would be grea ...

Blending HTML template and WordPress PHP file

I am facing a challenge while attempting to implement a Wordpress template on one of the pages of my website, specifically at http://www.windowblindshadeshutters.com/blog/. The blog has been successfully created, however, I am having trouble preserving our ...

Azure SQL Server linked with a REST API built on Express.js/Node.js encountered an error stating: "TypeError: req.sql is not a function"

Having trouble connecting to Azure SQL Server with express4-tedious. I'm working on building an app in react-native with a Node/Express server (REST API), but encountered this error after setting up express4-tedios in Express: req.sql is not a functio ...

Handling form submissions in Vue.js before navigating away from the current route

As a newcomer to VueJs, I am facing a problem with creating a form. My goal is to display an alert dialog with the message "you might lose the data, please save the data before you leave," and upon clicking 'yes', the form should be submitted and ...

What could be preventing my function from being invoked at regular intervals?

I have been attempting to trigger a function every few seconds with the following code snippet: HTML: <div id="Result">Click here for the message.</div> JS: $(document).ready(function () { $("#Result").click(function () { var ...

Three Js - The Ultimate Database for 3D Models

Greetings, all. I am currently in the process of developing a website that utilizes Three.js. I am seeking recommendations for a platform or online database where I can store both the 3D model file and the website database together, if feasible. Your assi ...

What are the steps to achieve the desired PrimeFaces theme appearance for selectOneMenu?

Need help with a JSF Primefaces project using the omega theme. The selectOneMenu dropdowns are not displaying correctly (missing line). Current look: https://i.stack.imgur.com/vF4ms.png Expected look: https://i.stack.imgur.com/hXsIB.png Any suggestion ...

Ways to troubleshoot the issue of undefined navigator / window / document in Nuxt

I encountered an issue while trying to extract UserAgent and Retina information within a Nuxt application. The error message I'm receiving states that navigator/window is undefined. How can I retrieve this information within my Nuxt application? const ...

The File is not being successfully sent to the controller in MVC due to AJAX returning an undefined value

I recently created an AJAXUpload method within a cshtml file in my C# MVC project: function AjaxUpload(url, method, data, successFunction, errorFunction, skipErrorDlg) { $.ajax({ contentType: false, processData: false, url: url ...

Dynamic toggling of attributes in Rails

Is there a way to toggle user attributes dynamically without creating separate methods for each attribute? def toggle item = params[:item] id = params[:id] @user = User.find(id) respond_to do |format| if @user.update("#{item}": ! ...

Tips on organizing JSON data with JavaScript

After receiving my $http response, the data is presented in the format below: $scope.rooms = { '2B' : [ {"RoomEmailId":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ebd9a9c6d8d9d8ab868ec5888486" ...

Different types of outputs that are suitable for a callback

I am currently developing a small node.js project focused on retrieving search terms from a Twitter feed. Although the search functionality is in place, I am facing difficulties in displaying this data on my webpage. The information I wish to showcase is s ...

Issue with AngularJS email input field not clearing or resetting after model binding is reset

I'm currently working on a form that includes fields for name, email, and phone number. <div ng-show="Nerd.adding"> <form class="col-sm-6" name="Nerd.nerdAddFrm" novalidate > <div class="form-group"> < ...

Exploring various ways to implement HTTP GET requests within the PrimeVue DatatableUsing a mix

I am facing a challenge where I need to use different GET requests to populate my Datatable with data from separate tables in the Database. Despite trying different approaches, I am unable to figure out how to make this work successfully. I have realized t ...

The getJson function seems to be malfunctioning for unknown reasons

I'm facing an issue with the getJson function when trying to execute it from a click listener. Everything else within the listener works fine except for the getJson function - none of the code inside getJson is being executed for some unknown reason. ...

The $http GET request is redirected to the incorrect URL, resulting in the search

Currently, I am in the process of developing a single page application and utilizing Angularjs v1.2.28 for this project. In order to retrieve data from the backend, I have implemented an HTTP GET request using the following code snippet. return { ...

Synk: the presence of a self-signed certificate within the certificate chain

Recently, I've been encountering the error message Synk Protect is showing "self-signed certificate in certificate chain" when I try to run npm install on a project of mine. Would appreciate any help or tips on how to identify which out of the 984 pac ...