eth.block
eth.block

Reputation: 504

Some specific hyperlinks in website not working

I am working on a website and it has a couple of links. When I click on links, nothing happens even though the browser status bar shows the target URL correctly. I checked that there is no z-index or any such issue (still might have missed something).

Here is the link of the site - http://www.deals4all.gr/city.php?ename=athens

Once there, click on "Select City" box and 2 links will be shown. Try clicking on either of them. None works. Moreover when I open the link in new tab or copy paste the link in new window, it works fine. I have checked this issue in IE, FF and Chrome.

Any help will be highly appreciated. Thanks!!

Upvotes: 2

Views: 186

Answers (2)

Andy E
Andy E

Reputation: 344575

This is a JavaScript issue — I noticed your code was obfuscated/packed using Dean Edwards' packer, so I pasted it into http://jsbeautifier.org and quickly found the problem:

jQuery('#guides-city-change').click(function () {
    return !jQuery('#guides-city-list').toggle()
});

When you click on a link, the click event bubbles up to #guides-city-change, firing the above handler. toggle() always returns the jQuery object it was called on, and negating an object with ! will always evaluate to false resulting in return false, which will cancel the default action of the <a> that the event originally fired on.

Since there is no default action for <div> elements, the easiest solution is to use event.stopPropagation() instead:

jQuery('#guides-city-change').click(function (e) {
    jQuery('#guides-city-list').toggle();
    e.stopPropagation();
});

Side note: if you're using the packer for obfuscation purposes then don't bother. As you can see, it's very easy to work around.

Upvotes: 4

smirkingman
smirkingman

Reputation: 6368

The link works correctly.

The problem is that navigating to

http://www.deals4all.gr/city.php?ename=athens

takes you back to the home page

Upvotes: 1

Related Questions