标签:find family div title 示例 font arc http jquery
find()方法返回被选元素的后代元素,一路向下直到最后一个后代。
<div> <p> <span>1</span> </p> <span>2</span> </div> <script> console.log($(‘div‘).find(‘span‘)); </script> <!-- 返回<span>1</span><span>2</span> -->
children()方法返回被选元素的所有直接子元素。该方法只会向下一级对 DOM 树进行遍历。
<div> <p> <span>1</span> </p> <span>2</span> </div> <script> console.log($(‘div‘).children(‘span‘)); </script> <!-- 返回<span>2</span> -->
标签:find family div title 示例 font arc http jquery
原文地址:http://www.cnblogs.com/mazey/p/7073037.html