<div id = "div1">
<div id = "div2">
</div>
</div>
<input type = "button" value = "Demo" id = "demo" />
<script type="text/javascript">
$("#demo").live("click", function () {
var id = $("#div2").parent().attr("id");
alert("Parent Id: " + id);
});
</script>