Codice PHP:
$(".commento").each(function(i){   
alert ($(this).attr('id'));  }) 
il problema sono attr(’id’)

ci vogliono o ' o "

+ veloce

Codice PHP:
$(".commento").each(function(i){      
alert (this.id);  
})