Question

I'm trying to use collapse element from bootstrap JavaScript library from this site:

http://getbootstrap.com/

Here's my code:

<link rel="stylesheet" type="text/css" href="Styles/bootstrap.css" />
<script type="text/javascript" src="Scripts/bootstrap.js"></script>

<div class="panel-group" id="accordion" style="width: 25%;">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
                    Collapsible Group Item #1
                </a>
            </h4>
        </div>
        <div id="collapseOne" class="panel-collapse collapse in">
            <div class="panel-body">
                Hello.
            </div>
        </div>
    </div>
</div>

But, it doesn't work. I suppose I haven't included something but what? I've tried to include collapse.js and transition.js, but it still doesn't work.

Was it helpful?

Solution

you need to add jquery

<script type="text/javascript" src="http://getbootstrap.com/assets/js/jquery.js"></script>

In getting started page:

jQuery required

Please note that all JavaScript plugins require jQuery to be included, as shown in the starter template.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top