October 24, 2024
Chicago 12, Melborne City, USA
jQuery

Collapse from Bootstrap site does not work


I am trying to learn collapsing with bootstrap and I copied the code directly from the site and it does not work when I paste it into my own html file. Can someone help me figure this out?

        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"     rel="stylesheet" integrity="sha384-    EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

    <p>
      <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button"    aria-expanded="false" aria-controls="collapseExample">
        Link with href
      </a>
      <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-    target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
        Button with data-bs-target
      </button>
    </p>
    <div class="collapse" id="collapseExample">
      <div class="card card-body">
        Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
      </div>
    </div>

Here is the JS FIDDLE
JS FIDDLE

I just copied some code. It works on their site but it does not work when I copy and paste the code. Am I missing something?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video