Any ideas on why my dropdown menu isn't working?

Any ideas on why my dropdown menu isn't working?
0

#1

Code for the dropdown menu starts around line 15, I’ve tried a few different things to get it working and nothing has so far; specifically, none of the actual menu suggestions work. Any suggestions?

https://codepen.io/Stephen0730/pen/mBJoYR?editors=1100


#2

Hi,
There are two problems with your markup:

<option><a href"#11">About</a></option>
<option><a href"#portfolio">Portfolio</a></option>
<option><a href"#contact">Contact</a></option>
  • It should be href=’#…’
  • Using select and option is not the normal way of making a dropdown menu

The standard way of making dropdown menus is to use markup like:

<nav>
  <ul>
    <li><a href='...
    <li><a href='...
    <li><a href='...

and use css and javascript to get the desired look and behavior. Google dropdown menu for examples and tutorials.

But, if you really needed to not use javascript, you could probably make it work with select and option by doing something like:

<select onchange="window.location.href=this.value">
    <option>#portfilio</option>
    <option>#contact</option>

#3

Hi there,

Sorry but you dont have any classes for dropdown menu.
I hope, this link will be helpful for your problem.

Btw, you dont need use cdn for bootstrap in the CodePen. You can simply choose from Settings -> CSS -> Quick Add -> Bootstrap.

Hope. it helps. :slight_smile: