0

My jQuery code (extracted from below), isn't working in 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 %}
Shiladitya
  • 12,003
  • 15
  • 25
  • 38
P. A
  • 13
  • 3
  • 2
    You're going to need to expand on "isn't working". What are you trying to do? What are you observing? What do you mean by "displaying"? (And do you mean "js/jquery.multi-select.js" or "/static/js/jquery.multi-select.js"?) – Dave W. Smith Nov 08 '18 at 03:50
  • sorry if it was vague. the thing javascript formatting is not appearing in my html - for all the scripts. But when i run it offline not using flask just as an html it works – P. A Nov 08 '18 at 07:24
  • Possible duplicate of [Link to Flask static files with url\_for](https://stackoverflow.com/questions/16351826/link-to-flask-static-files-with-url-for) – Dinko Pehar Nov 08 '18 at 08:05

1 Answers1

1

ex.your js folder 'static'

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