Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

links in dropdown not working

Featured Replies

I have a problem with links in dropdown menu. If you try to click on the link on dropown the menu will just close without redirecting to a new page. This is the menu I am using

 

http://codepen.io/TimRuby/pen/kLGic

 

Try to replace # in dropdown link with http://google.com or something to see what i mean, the link will only close the menu. Same effect with toggle menu on responsive.

 

What is going on here?

 

TY in advance

$(hasChild).click(function(e) {
    //e.preventDefault();  //Remove this 
    dropdown.toggle();
  });

Remove the line e.preventDefault(); from the click handler for the dropdown (line 14 in your js) I commented it out in the code as above and it works fine

  • 2 weeks later...

I noticed the elements that called the toggle function was li elements so preventDefault was not assigned to the links: Here is a working solution:

http://jsfiddle.net/Nillervision/9aXhM/1/

I simply added a className to the link in question

<a class="dl" href="#">Features</a>

and called the function from the link as well:

disabledLink = $('.dl'); /*reference to the a element targeting its classname*/

$(disabledLink, hasChild).click(function(e) {
    e.preventDefault();
    dropdown.toggle();
  });

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.