1.parent([expr]) :取得一个包含着所有匹配元素的唯一父元素的元素集合。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-3.3.1.js"></script>
</head>
<body>
<div>
<a id="link" href="http://www.baidu.com" target="_blank">百度</a>
</div>
<script>
console.log($("#link").parent()[0]);
console.log("1111");
</script>
</body>
</html>
运行结果
2.children([expr]) :获取匹配元素的所有子元素组成的集合;该方法只考虑子元素而不考虑任何后代元素。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-3.3.1.js"></script>
</head>
<body>
<table>
<thead>
<tr>
<th>编号</th>
<th>姓名</th>
<th>手机号</th>
<th>家庭地址</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Tom</td>
<td>18838218972</td>
<td>河南省郑州市高新区</td>
<td>
<a href="###">查看</a>
<a href="###">编辑</a>
<a href="###">删除</a>
</td>
</tr>
</tbody>
</table>
<script>
$("tbody tr").children().each(function(){
console.log(this);
});
</script>
</body>
</html>
运行结果