supposed we have
<a href=# id="5"> hello world </a>

to get the value of id

$('a').each(function(){alert(this.id);});
//5