这让我疯了.
我有这个:
<div class="container"> <div class="panel panel-primary"> <div class="panel-heading" id="panel-head"> <a data-toggle="collapse" data-target="#collapseDiv" class="white-link" id="toggle" >Records Added <span class="indicator glyphicon glyphicon-chevron-down pull-left pad-right" id ="glyphicon"></span> </a> </div> <div id="collapseDiv" class="panel-collapse collapse"> <div class="panel-body">
而我正试图用这种方式解决崩溃问题(以各种方式):
$( ‘#collapseDiv’).崩溃( “切换”)
我得到的只是:
Uncaught TypeError: $(…).collapse is not a function(…)
有任何想法吗?
“`
“`
解决方法
确保Jquery包含在Bootstrap之上,它工作正常
$('#collapseDiv').collapse("toggle");
.white-link{color:#fff;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <div class="container"> <div class="panel panel-primary"> <div class="panel-heading" id="panel-head"> <a data-toggle="collapse" data-target="#collapseDiv" class="white-link" id="toggle">Records Added <span class="indicator glyphicon glyphicon-chevron-down pull-left pad-right" id ="glyphicon"></span> </a> </div> <div id="collapseDiv" class="panel-collapse collapse"> <div class="panel-body">