jquery无法使用django模板的cdn工作

ljr*_*jrh 2 html python django jquery cdn

这是我的模板部分,从CDN加载jquery:

<head>
    {% load staticfiles %}


    <title>My Schedule</title>
    <link href="{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet">
    <script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
    <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>

</head>

<body>
    {% if user.is_authenticated %}
        <div class="btn-group">
            <a href="#" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" style="margin: 3px;">
                {{ user.username }}
                <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
                <li><a href="#">Action1</a></li>
            </ul>
        </div>
    {% endif %}
Run Code Online (Sandbox Code Playgroud)

但我似乎无法让下拉列表正常工作,虽然它在在线模拟器中工作正常..

感谢您的任何见解!

kar*_*ikr 5

您需要将jqueryjs文件放在所有其他js文件之前.像这样的东西(按顺序注意开关):

<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
Run Code Online (Sandbox Code Playgroud)