SyntaxFix
Write A Post
Hire A Developer
Questions
As of jQuery 1.6, you could (and some would say should) use .prop instead of .attr
$('.test').click(function(){ alert($(this).prop('id')); });
It is discussed further in this post: .prop() vs .attr()