x
 
<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery.min.js"></script>
</head>
<body>
<h1>获取父级 HTML 元素</h1>
<h2 id="01">Hello World!</h2>
<h2 id="02">Hello China!</h2>
<h2 id="03">Hello Shanghai!</h2>
<p id="demo"></p>
<script>
$(document).ready(function() {
  var myParent = $("#02").parent();
  $("#demo").text(myParent.prop("nodeName")); 
});
</script>
</body>
</html>