Locked lesson.
About this lesson
In this lesson, we'll discuss how to add Javascript to your Django projects.
Exercise files
Download this lesson’s related exercise files.
Using Javascript.docx57.4 KB Using Javascript - Solution.docx
57.9 KB
Quick reference
Using Javascript
Using Javascript in your Django project is fairly straightforward. Add it to your static folder like with CSS and Images.
When to use
Do this any time you want to use Javascript on one of your web pages.
Instructions
Add A directory to your /static/resume/ directory called javascript. Save all your javascript files there. To reference them on a web page, be sure to load your static:
{% load static %}
And to reference the javascript on a web page:
<script src="{% static 'resume/javascript/javascript_file.js' %}"></script>
Hints & tips
- Don't forget to {% load static %}
- <script src="{% static 'resume/javascript/javascript_file.js' %}"></script>
Lesson notes are only available for subscribers.