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 %}
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"?) Commented Nov 8, 2018 at 3: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 Commented Nov 8, 2018 at 7:24
  • Possible duplicate of Link to Flask static files with url_for Commented Nov 8, 2018 at 8:05

1 Answer 1

1

ex.your js folder 'static'

<script src="{{ url_for('static', filename='js/jquery.multi-select.js') }}"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.