所以说我想检查square [6]是否在行[2]中。我该怎么做?我希望能够判断两个方格是否在同一行内。
<!--Row 1-->
<div class = "row">
<!--Square 1-->
<div class = "square" onclick="clicked(0,0)"></div>
<!--Square 2-->
<div class = "square" onclick="clicked(1,0)"></div>
<!--Square 3-->
<div class = "square" onclick="clicked(2,0)"></div>
<!--Square 4-->
<div class = "square" onclick="clicked(3,0)"></div>
</div>
<!--Row 2-->
<div class = "row">
<!--Square 5-->
<div class = "square" onclick="clicked(4,1)"></div>
<!--Square 6-->
<div class = "square" onclick="clicked(5,1)"></div>
<!--Square 7-->
<div class = "square" onclick="clicked(6,1)"></div>
<!--Square 8-->
<div class = "square" onclick="clicked(7,1)"></div>
</div>
答案 0 :(得分:1)
recipes_vectors
检查一个人是否是另一个人的父母
答案 1 :(得分:-1)
使用jQuery:
var $element = $('CHILD ELEMENT CLASS / SELECTOR HERE');
$element.parents('PARENT CLASS / SELECTOR HERE').length > 0