@jlee1215 The order is important too, jQuery must be before the Bootstrap.js . Try building a navbar by copying the bootstrap example just to make sure your environment works. Then I would check your list opening and closing tags. I am commuting on a train now so hard to see with the shaking, but for some reason the opening and closing tags seem off somewhere. Maybe I am not seeing it right, but maybe look again.
are you adding your javascript and bootstrap files correctly ? Take a look at this article and make sure you are adding everything correctly. Let me know if this helps
Sorry for the delay, the evenings are harder for me to get online.
This is my codepen. I have inserted following your article Michael and still my dropdown is not working. I am not sure what I am doing wrong but I will keep fighting my way through here. I appreciate all the suggestions. I enjoy the iterative process and each suggestion has helped me learn a little.
There are some mistakes in your Javascript that needs to be corrected. The dropdown works after!
In Codepen, there is no need to wrap your JS code in script tags.Also, some things that pop out :
$(’.navbar a, footer a [href’#mypage’]").on(‘click’,function(event){
This line doesn’t work because you mixed quotation marks. If you have any double quotes in your selectors, you need to use single quotes to wrap them :
$(’.navbar a, footer a[href="#mypage"]’).on(‘click’,function(event){
and this :
(this.hash !++"") {
++ is incrementing a value. Here I suppose you wanted to check if hash was an empty string so it should be :
(this.hash !== “”) {
You also got a single quote mark somewhere that is breaking your code on line 9
Thank you so much. I am more familiar with the HTML side of things so far so the JS was really throwing me. I actually copied that from someone who suggested it. It would have taken me forever to figure that out.
You have some important parts missing, such as the ‘hamburger’ icon for when the navbar collapses. I’d recommend reading through the example on the components page and fiddling with it to see what tags and attributes are used for what in the navbar.
There are other issues as well, but I’m on my phone so it’s hard to give a blow-by-blow account
I was also struggeling to get bootstrap menu working. I loaded bootstrap under css and jquery and bootstrap under javascript. It didnt work. Then i tried to copy and paste older version of bootstrap and jquery in the setting from this other pen http://codepen.io/twittem/pen/lwbjC?editors=1100 and then it finally worked.
I had the same issue, the version of bootstrap and jquery were not causing the problem but the order in which I load the libraries made the difference. jQuery library should be added before the bootstrap library.