Complete the code to create a button that toggles a collapse element.
<button class="btn btn-primary" type="button" data-bs-toggle="[1]" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Toggle Collapse </button>
The data-bs-toggle="collapse" attribute tells Bootstrap that this button will toggle a collapse element.
Complete the code to define the collapsible content container with the correct class.
<div class="[1]" id="collapseExample"> <div class="card card-body"> This is some collapsible content. </div> </div>
The collapsible content container must have the collapse class for Bootstrap to recognize it as collapsible.
Fix the error in the button code to correctly toggle the collapse element.
<button class="btn btn-secondary" type="button" data-bs-toggle="[1]" data-bs-target="#myCollapse" aria-expanded="false" aria-controls="myCollapse"> Show/Hide </button>
The data-bs-toggle attribute must be set to "collapse" to toggle a collapse element.
Fill both blanks to create a button and a collapsible content area that works together.
<button class="btn btn-info" type="button" data-bs-toggle="[1]" data-bs-target="#infoCollapse" aria-expanded="false" aria-controls="infoCollapse"> Info Toggle </button> <div class="[2]" id="infoCollapse"> <div class="card card-body"> Here is some info content. </div> </div>
The button's data-bs-toggle and the content container's class must both be "collapse" for the toggle to work.
Fill all three blanks to create a button that toggles a collapse with accessible attributes.
<button class="btn btn-success" type="button" data-bs-toggle="[1]" data-bs-target="#collapseContent" aria-expanded="[2]" aria-controls="[3]"> Toggle Content </button>
The button toggles a collapse, so data-bs-toggle is "collapse". The aria-expanded starts as "false" because content is hidden initially. The aria-controls matches the ID of the collapsible content.