Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't follow <a> link when clicking on a menu item #15

Open
mc7244 opened this issue Oct 30, 2013 · 1 comment
Open

Don't follow <a> link when clicking on a menu item #15

mc7244 opened this issue Oct 30, 2013 · 1 comment

Comments

@mc7244
Copy link

mc7244 commented Oct 30, 2013

in createMenu() the click on menu items is listened to this way:

    if (item.action) {
      row.find('a').click(function(){ item.action(e); });
    }

This doesn't stop the tag to follow its href: it's (almost) harmless most of the time, but with complex URLs (i.e. with path parameters) this causes another page to load instead of the current one.

The code should me changed to:

    if (item.action) {
      row.find('a').click(function(){ item.action(e); return false; });
    }

Returning false ensures the href is not followed.

@gonz002
Copy link

gonz002 commented Mar 17, 2014

This works for me. :)

if (item.action) {
row.find('a').click(function(v){ item.action(e); v.preventDefault(); });
}

Happy coding..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants