亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery ?? parent() ???

jQuery? ??? ?????. ???? ?? ? ??? ?? ?? ??? ??? ???? parent() ???? ???? ???.

?? find? parent? ???? ?????. ? ??? ???? ??? ?? ???? ?????

?? ?? ?? ??:

<div class="div">
<ul class="son">
<li class="grandson"> ;1</li>
</ul>
</div>

li ???? ?? ?? div? ????. ???? $("li? ??? ? ????. ").parents() ???

parents() ??

parents() ??? ????? ???? DOM ???? ??? ??? ?? ??? ????, ???? ??? ??? ?????, ???? ? jQuery ??? ??? ? ????.

??? ?? ??? ?? ??? ?? ???? ?????.

??: jQuery? ??? ????? ?? ??? ???? ?? ??? ???? ?? ?????.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ????? jQuery? ??? ??? ?? ?? ??? ?? ?? ??? ??? ????? ? ? ???? ??? ???? ???? ?? ?????


??:

1.parents() ? .parent () ???? ?????. ??? ??? ?? ?? DOM ?? ??? ?????

2 $( "html" ).parent() ???? ??? ??? ???? ???? ?? $( "html" ).parents( )? ? ???? ?????.



??? ???????:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>

<body>
    <div>php.cn
        <ul>php
          <li>php 中文網(wǎng)</li>
          <li>php 中文網(wǎng)</li>
        </ul>
    </div>
<script>
    $("li").parents().css('color','red');
</script>

</body>
</html>
???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <div>php.cn <ul>php <li>php 中文網(wǎng)</li> <li>php 中文網(wǎng)</li> </ul> </div> <script> $("li").parents().css('color','red'); </script> </body> </html>