tags:

views:

37

answers:

4

I want to do this: when you click a link on a page, it will open the link normally, but when you double click the link, it will alert the link's 'href' attribute.

However, when I try to double click a link, it will always open the link. Any idea?

A: 

a double click is two clicks, thus it fires the click event

NimChimpsky
A: 

Because the onclick event gets fired before the ondbclick event. That is the reson why ondblclick does not get executed -> the link gets loaded first.

Thariama
A: 

maybe it's just a typo: the event you're looking for is named ondblclick, not ondbclick.

oezi
+1  A: 

To avoid the link being opened, you may want to work with right-clicks instead.

bemace