# Javascript is not loaded in html in django

**URL:** <https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501>\
**Category:** Using Django\
**Created:** [February 9, 2021, 10:24am UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501 "2021-02-09T10:24:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayeedhossain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sayeedhossain/32/3326_2.png) [@sayeedhossain](https://forum.djangoproject.com/u/sayeedhossain)\
**Post date:** [February 9, 2021, 10:24am UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501/1 "2021-02-09T10:24:32Z")

</div>

In my project,there is a register.html file . the file is given below:

> ```
> <!DOCTYPE html> 
> {% load static %}
> <html>
> <head>
> <title>Page Title</title>
> </head> 
> <body> 
> <p>This is only for test.</p> 
> </body>
> 
> <script> src= "{% static 'js/register.js' %}" </script>
> 
> </html>
> 
> ```

Here you can see the javascript part in the last section. This script should be load the register.js file which is exists in app\_name/static/js/register.js . But the problem is that the register.js file is not loaded .  
The register.js file is given below:  
console.log(“this is working”);

when I run this , the console look as that picture which is given below:

 ![Screenshot from 2021-02-09 16-14-26](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/4bf9df08f7306457a2de2ed3daeed8c269aa25ef.png)

Even If I give full path such as `<script> src= "/home/name/python/django/python test/app_name/static/js/register.js" </script>` then also the error is still remain .  
But if I give direct code like `<script> console.log("this is test"); </script>` then it perfectly worked.  
How can I solve this issue?

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [February 9, 2021, 10:28am UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501/2 "2021-02-09T10:28:49Z")

</div>

Try putting the script tag inside the `<head>` or `<body>` elements.

---

<div class="post-metadata">

**Author:** ![sayeedhossain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sayeedhossain/32/3326_2.png) [@sayeedhossain](https://forum.djangoproject.com/u/sayeedhossain)\
**Post date:** [February 9, 2021, 11:12am UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501/3 "2021-02-09T11:12:33Z")

</div>

Already try that but the issue is still remain.

---

<div class="post-metadata">

**Author:** ![sayeedhossain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sayeedhossain/32/3326_2.png) [@sayeedhossain](https://forum.djangoproject.com/u/sayeedhossain)\
**Post date:** [February 9, 2021, 11:28am UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501/4 "2021-02-09T11:28:14Z")

</div>

Even If I give full path such as `<script> src= "/home/name/python/django/python test/app_name/static/js/register.js" </script>` then also the error is still remain .

---

<div class="post-metadata">

**Author:** ![sayeedhossain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sayeedhossain/32/3326_2.png) [@sayeedhossain](https://forum.djangoproject.com/u/sayeedhossain)\
**Post date:** [February 9, 2021, 1:13pm UTC](https://forum.djangoproject.com/t/javascript-is-not-loaded-in-html-in-django/6501/5 "2021-02-09T13:13:01Z")

</div>

oh! sorry . I made a mistake . Actually src=… should be inside the tag, i.e. `<script src=...> </script>` . Now everything is fine.
