0

I am using three javascript files: bootstrap.js,jquery.js,bootstrap-dropdown.js.I have implemented a header in every html page in my project that has a dropdown and in one html page I have implemented a modal class. Now whenever I import bootstrap.js before jquery.js the dropdown works but the modal class doesn't and when I do the reverse the modal works but the dropdown does not.

The list of js files in sequence i have used:

<script src="@{'/public/javascripts/bootstrap.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script src="@{'/public/javascripts/jquery.js'}" type="text/javascript" charset="${_response_encoding}"></script>

<script src="@{'/public/javascripts/sessvars.js'}" type="text/javascript" charset="${_response_encoding}"></script>

<script src="@{'/public/javascripts/jquery-ui-1.7.2.custom.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script src="@{'/public/javascripts/sessvars.js'}" type="text/javascript" charset="${_response_encoding}"></script>
<script src="@{'/public/javascripts/bootstrap-dropdown.js'}" type="text/javascript" charset="${_response_encoding}"></script>
4

1 回答 1

3

bootstrap 依赖 jquery,所以需要在 bootstrap 之前声明 jquery 脚本

下拉代码通常包含在 bootstrap.js 中,因此您不需要两个声明。

如果仍有问题,请打开浏览器错误控制台以查看问题所在

于 2012-09-11T08:36:07.577 回答