Jquery通过parent//children获取值

首先,页面引用jquery文件

例:html页面

<body>
    <div style="width:1000px;height:800px;border:1px solid red;">
        <div style="width:650px;height:500px;border:1px solid yellow;"><span id="aaxt">123</span></div>
        <div style="width:650px;height:200px;border:1px solid green;"><span>456</span></div>
    </div>
</body>

例:js页面

1 <script>
2     $(function(){
3          var Attr = $("#aatx").parent().parent().children().eq(1).children(),
4                Dumpcon = Attr.html();
5          console.log(Dumpcon);       //456
6     })
7 </script>

 

posted @ 2018-09-26 11:49  樊琇鸿  阅读(916)  评论(0编辑  收藏  举报