gpt4 book ai didi

jquery - Bootstrap 崩溃不适用于 JQuery

转载 作者:行者123 更新时间:2023-12-03 22:16:57 25 4
gpt4 key购买 nike

这让我发疯。

我有这个:

<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').collapse("切换")

我得到的是:

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">

关于jquery - Bootstrap 崩溃不适用于 JQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35600483/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com