Javascript examples for DOM Event:onclick
Detect which anchor is clicked
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <a href="javascript:changeFreq(this)">Anchor 1</a> <a href="javascript:changeFreq(this)">Anchor 2</a> <a href="javascript:changeFreq(this)">Anchor 3</a> <script type="text/javascript"> function changeFreq(element) {//from w w w . j a va 2 s .c o m // element is the ... wait for it ... element console.log(element); } </script> </body> </html>