jquery next nextAll nextUntil siblings的区别
来源:互联网 发布:桂圆淘宝 编辑:程序博客网 时间:2024/04/28 14:08
next:紧挨着$('')的一个元素
nextAll:在$('')以后的所有的同辈元素
nextUntil:until有直到。。。之前的意思,所以他表示$('')以后的所有的同辈元素,不过要在nextUntil参数之前,不包括匹配的元素本身
sibings:$('')前后的所有同辈元素
简单理解就是,next就是找他的弟弟/妹妹,nextAll就是找他所有的弟弟/妹妹,nextUntil就是找比他小一定年龄的弟弟/妹妹,siblings就是找他所有的哥哥/姐姐,还有他的所有的弟弟/妹妹。所以同理的同辈关系,prev,prevAll ,prevUntil
下面是简单的测试代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
</head>
<body>
<div class="first">
<a href="#">hhh</a>
<h1>这是一个标题</h1>
<p>这是一个test</p>
<p>这是一个test</p>
<p>这是一个test</p>
<p>这是一个test</p>
<div>hhha</div>
<p>这是一个test</p>
<p>这是一个test</p>
</div>
<script>
$(function(){
//$('p:first').next().css('background','red');
//$('p:first').nextAll().css('background','yellow');
//$('p:first').nextUntil('div').css({'font-size':20,background:'red'});
//$('p:first').siblings().css('background','yellow');
});
</script>
</body>
</html>
- jquery next nextAll nextUntil siblings的区别
- next(), nextAll(), siblings()的区别
- jQuery 遍历 - 同层方法siblings() next() nextAll() nextUntil() prev() prevAll() prevUntil()(二十四)
- jQuery源码分析之parents,parentsUntil,next,prev,nextAll,prevAll,nextUntil,prevUntil,siblings,children
- jquery层次选择器:空格 > next + nextAll ~ siblings
- jquery 层次选择器(siblings与nextAll的区别)
- 知识点六:jQuery遍历-同胞Siblings(), next(), nextAll()
- next()和nextAll()的区别
- Jquery的parentsUntil()、nextUntil()、sibliings()的区别
- jQuery parent(),next(),nextAll(),andSelf()
- Jquery 里的节点遍历(next(),perv(),nextAll(),prevAll())
- JQuery 层级选择器(next(),preAll(),siblings(),parent())
- jQuery遍历之next()、nextAll()方法使用实例
- JQuery的siblings()使用
- jQuery siblings() 的作用
- jquery siblings()的用法
- jquery的siblings、index()属性
- jquery中siblings的用法
- AndroidLog日志调试(android.utl.log类)
- 计算机视觉和模式识别的code
- 从一道++操作面试题说起(Javap)
- apt-get 工作原理
- simhash
- jquery next nextAll nextUntil siblings的区别
- 29 - Search in Rotated Sorted Array
- Deeplearning学习之路_第四章(Self-Taught learning&deep networks)
- asp.net 如何让虚拟目录里面的webconfig不继承主目录config
- Servlet的生命周期?
- 晶振与晶振的作用
- 禅修促进自我成长
- Microsoft Enterprise Library 5.0 系列教程(二) Cryptography Application Block (高级)
- Microsoft Enterprise Library 5.0 系列教程(三) Validation Application Block (初级)