<!doctype html>
<html>
<head>
<script type="text/javascript"src="
http://www.w3school.com.cn/jquery/jquery-1.11.1.min.js"></script><script>
$(function(){
var obj = "";
$("div.class2").click(function(){
obj = $(this).parent();
alert(obj.attr("class"));
});
});
</script>
<style>
div{padding:10px 20px;border:4px solid #ebcbbe;}
div.class1{width:200px;height:120px;}
</style>
</head>
<body>
<div>
class1
<div>
class2
</div>
</div>
</body>本回答被提问者采纳