How do I bind a click to an anchor without a framework (javascript)
Posted
by Stomped
on Stack Overflow
See other posts from Stack Overflow
or by Stomped
Published on 2010-06-03T13:03:21Z
Indexed on
2010/06/03
13:14 UTC
Read the original article
Hit count: 169
JavaScript
|events
I know this is easily done in jQuery or any other framework, but that's not really the point. How do I go about 'properly' binding a click event in pure javascript? I know how to do it inline (I know this is terrible)
<a href="doc.html" onclick="myFunc(); return false">click here</a>
and this causes my javascript to execute for a JS enabled browser, and the link to behave normally for those without javascript?
Now, how do I do the same thing in a non-inline manner?
© Stack Overflow or respective owner