javaGirl243 javaGirl243 - 1 year ago 151
HTML Question

Bootstrap JS not loading

The solution to this problem might be very trivial but its got me banging my head on walls! Bootstrap's js files are not loading on my web page for some reason.

I simplified the page to the bare minimum and here's the code:

<!DOCTYPE html>

<link rel="stylesheet" href="">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="cz" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="caret"></span>
<ul class="dropdown-menu" aria-labelledby="cz">
<li><a href="#">Option 1</a></li>
<li><a href="#">Option 2</a></li>
<li><a href="#">Option 3</a></li>
<script type="text/javascript" src=""/>
<script type="text/javascript" src=""></script>

Now when I click on the button, nothing happens and I don't see the dropdown. When I checked the js files loaded(through browser inspect element), I see that only JQuery has loaded.

If I remove JQuery, I get the correct error that Bootstrap requires Jquery. I've created a codepen and it works perfectly fine on it. Could someone help me with this please?? :(

Answer Source

you didn't close first tag. it should be,

<script type="text/javascript" src=""></script>

UPDATE : if you are thinking why self closing script tags are not working, refer this. Why don't self-closing script tags work?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download