【问题标题】:jQuery script not displaying in FlaskjQuery 脚本未在 Flask 中显示
【发布时间】:2018-11-08 02:55:20
【问题描述】:

我的jQuery 代码(从下面提取)在Flask 中不起作用

{% block scripts %}
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js" /> 
  <!-- Bootstrap JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter- bootstrap/4.0.0-alpha/js/bootstrap.min.js" />
  <script src="js/jquery.multi-select.js" />
  <script type="text/javascript">
    // run pre selected options
    $('#pre-selected-options').multiSelect();
  </script>
{% endblock %}

【问题讨论】:

  • 您将需要扩展“不工作”。你想做什么?你在观察什么? “显示”是什么意思? (你的意思是“js/jquery.multi-select.js”还是“/static/js/jquery.multi-select.js”?)
  • 很抱歉,如果它含糊不清。我的html中没有出现javascript格式的东西-对于所有脚本。但是当我离线运行它时,不使用烧瓶作为 html 它可以工作

标签: python jquery html flask


【解决方案1】:

ex.你的 js 文件夹“静态”

<script src="{{ url_for('static', filename='js/jquery.multi-select.js') }}"></script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-08
    • 2020-03-02
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 2020-01-16
    • 1970-01-01
    相关资源
    最近更新 更多