尝试在表单中使用Boostrap崩溃,但它没有响应。复制&直接从Boostrap网站粘贴,但仍无效。请帮忙!
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" data-target="firstname" aria-expanded="false" aria-controls="collapseExample">
Test
</a>
<form>
<div class="form-row mb-1 collapse" id="firstname">
<div class="form-group col-md-6">
<input type="email" class="form-control" placeholder="Legal first name">
</div>
</div>
<div class="form-group col-md-6">
<input type="password" class="form-control" id="inputPassword4" placeholder="Legal last name">
</div>
</div>
</form>
答案 0 :(得分:1)
您错过了要切换的元素中的id = "collapseExample"
或data-target="#collapseExample"
https://getbootstrap.com/docs/4.0/components/collapse/