Search code examples
javascriptbootstrap-4bootstrap-modalangular-ui-bootstrapreact-bootstrap

Bootstrap Data-bs-toggle is not working in the currently version?


I notice that bootstrap 5.1.3 data-bs-toggle isn't working anymore. Like in this exemple:

<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" datadat-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </a>
  <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
    <li><hr class="dropdown-divider"></li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</li>

If you use the data-bs-toggle="dropdown" it just doens't work. I would like to know if this is happening with you too and why is that? Maybe the version 5.1.3 has some kind of bug? Here is the bootstrap official page for this NavBar component example: https://getbootstrap.com/docs/5.1/components/navbar/


Solution

  • Now I know what I was doing wrong... While working on my project, I was using a minimal version of bootstrap that my teacher provided me, and he was using it with lower version bootstrap, so data-bs-toggle was not working... :) thanks for the answers