How to set correct context of $(this) within anonymous function called by event

How to set correct context of $(this) within anonymous function called by event

I would like to access the ID attribute of an element selected within the click event of another object.  The code below shows the ID for the #button but i want the ID for the .a class element.  I think I need to use proxy but I could use some guidance.  Thanks in advance.

$(document).ready(
$(function () {
    $('#button').on('click', function () {
        $(".a").append("<p>ID:" + $(this).attr("id") + "</p>");
    });
}));

Example: