0

I am new using Django and I am having difficulties being able to implement javascript into my html file.

<head>
     <title>Home Page</title>
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     {% load staticfiles %}
     <link rel="stylesheet" href="{% static personal/css/bootstrap.min.css'%}" type = "text/css"/>
     <link rel="stylesheet" href="{% static 'personal/customcss/custom.css' %}" type="text/css" />
     <script  src="{% static 'personal/jquery/jquery-3.2.1.min' %}" type="text/javascript"></script> 
     <script  src="{% static 'personal/js/bootstrap.min.js' %}" type="text/javascript"></script> 
</head>

All my files are on the static folder. The CSS is working fine but whenever I try to use javascript for a button, it isn't working.

<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbar2SupportedContent" aria-controls="navbar2SupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>

Thanks in advance.

dvnguyen
  • 2,954
  • 17
  • 24
Mateaus
  • 33
  • 1
  • 6
  • 2
    Possible duplicate of [Django Static js files not working](https://stackoverflow.com/questions/32044489/django-static-js-files-not-working) – pastaleg Jan 09 '18 at 04:00
  • I went over multiple stackoverflows in regards to this but none were able to fix my issue. – Mateaus Jan 09 '18 at 15:24
  • You should help us out by explaining what approaches you have tried. The questions i linked gives you a solution where you add STATIC_ROOT = os.path.join(BASE_DIR, 'static') in your settings.py file. Did that not work? – pastaleg Jan 09 '18 at 15:46
  • I have STATIC_URL = '/static/' and below it STATIC_ROOT = os.path.join(BASE_DIR, 'static') yet javascript is still not being implemented in my html when I call it. – Mateaus Jan 09 '18 at 18:01

0 Answers0