'bootstrap JavaScript not working as in when the screen size is decreased the menu bar wont work
so I'm working with Django for the first time and I am following a tutorial, bootstrap is used for the navbar so I added the CSS from bootstrap it worked but the JavaScript from bootstrap is not working, I know that because when the screen size is reduced, a menu bar appears instead of the navbar items but it doesn't work when clicked. How can I fix this?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CRMain</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
{% include "accounts/navbar.html"%}
{% block content %}
{% endblock %}
<hr>
<h5>footer</h5>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
</body>
</html>
2 screenshots of the before and after:- https://i.stack.imgur.com/7I5he.png https://i.stack.imgur.com/JteLC.png
Solution 1:[1]
<script> won't validate outside of the <body> or <head> tags.
<html>
....
<body>
....
<script type="text/javascript" src="....."></script>
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RENJITH V.S |
