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/[email protected]/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?
2
Answers
You need the bootstrap.bundle.min.js script too
cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js
Try these links?