Complete the code to create a button that toggles expandable content using Bootstrap.
<button class="btn btn-primary" type="button" data-bs-toggle="[1]" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Toggle Content </button>
The data-bs-toggle="collapse" attribute tells Bootstrap to toggle the collapse component, which is used for expandable content.
Complete the code to define the collapsible content area with the correct Bootstrap class.
<div class="[1]" id="collapseExample"> <div class="card card-body"> This content is hidden until toggled. </div> </div>
The collapse class defines the collapsible content area that expands or collapses when toggled.
Fix the error in the button code to correctly toggle the collapsible content.
<button class="btn btn-primary" type="button" data-bs-toggle="[1]" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Toggle Content </button>
The toggle attribute must be set to collapse to control expandable content properly.
Fill both blanks to create a collapsible section with a button and content area.
<button class="btn btn-secondary" type="button" data-bs-toggle="[1]" data-bs-target="#infoCollapse" aria-expanded="false" aria-controls="infoCollapse"> Show Info </button> <div class="[2]" id="infoCollapse"> <div class="card card-body"> Extra information shown here. </div> </div>
The button uses data-bs-toggle="collapse" and the content div uses the collapse class to create expandable content.
Fill all three blanks to create a button that toggles expandable content with accessible attributes.
<button class="btn btn-info" type="button" data-bs-toggle="[1]" data-bs-target="#detailsCollapse" aria-expanded="[2]" aria-controls="detailsCollapse"> Details </button> <div class="[3]" id="detailsCollapse"> <div class="card card-body"> Detailed content goes here. </div> </div>
The button toggles the collapse component. The aria-expanded attribute starts as false because the content is hidden initially. The content div uses the collapse class.