serhioses,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
a:after{
content: attr(data-id);
}
</style>
</head>
<body>
<ul>
<li><a data-id="1"></a></li>
<li><a data-id="2"></a></li>
<li><a data-id="3"></a></li>
<li><a data-id="4"></a></li>
</ul>
<script>
var a = document.getElementsByTagName('a'), fn = function() {
alert(this.dataset.id)
},i=0, el;
for ( ; el = a[i++]; ) el.addEventListener('click', fn, false);
</script>
</body>
</html>