<html> | |
<style>a { text-decoration: underline; display: block; }</style> | |
<body> | |
<a onclick="javascript:alert('1');">link with no href but onclick</a> | |
<a id="add-click-handler-to-me">link with no href and click handler added via script</a> | |
<script> | |
document.getElementById('add-click-handler-to-me'). | |
addEventListener('click', function() { alert('2'); }, false); | |
</script> | |
</body> | |
</html> |