Issue
I tried to make a button that displays the hidden content when revealed using bootstrap but it's not working. Any Suggestions
<button class="bc2 border-primary bg-primary rounded-2 mt-4 p-1 text-nowrap card-footer text-white" type="button" data-toggle="collapse" data-target="#ho2" aria-expanded="false" aria-controls="ho2">Get Started</button>
<div class="collapse" id="ho2">
<div class="card card-body">
Hello World!
</div>
</div>
Solution
Changed the data attr to data-bs-*
(for BS5).
If correct BS js file and css file are included it should work.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
<button class="bc2 border-primary bg-primary rounded-2 mt-4 p-1 text-nowrap card-footer text-white" type="button" data-bs-toggle="collapse" data-bs-target="#ho2" aria-expanded="false" aria-controls="ho2">Get Started</button>
<div class="collapse" id="ho2">
<div class="card card-body">
Hello World!
</div>
</div>
Answered By - Flewz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.