Javascript get anchor href on click

Posted by Infinity on Stack Overflow See other posts from Stack Overflow or by Infinity
Published on 2010-06-11T10:39:02Z Indexed on 2010/06/11 10:42 UTC
Read the original article Hit count: 237

Hello guys!

How can I get the href of an anchor when I click on it using javascript? I did the following:

document.onClick = myFunc();
function myFunc() {
}

But how to extend the function to respond only to clicks on anchors and get the href?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events