If you want to get an ID of an element, let's say by a class selector, when an event (in this case click event) was fired on that specific element, then the following will do the job:
$('.your-selector').click(function(){
var id = $(this).attr('id');
});