I have a div like this:
x
You should do
$(".popupCloseClass").click(function (event) { var id = $(this).closest("div").attr("id"); });
(you could also use $(this).parent().attr("id"); ) but using closest is safer in case you change your html structure
$(this).parent().attr("id");