Home > Web Front-end > JS Tutorial > Introduction to the differences between jquery next nextAll nextUntil siblings_jquery

Introduction to the differences between jquery next nextAll nextUntil siblings_jquery

WBOY
Release: 2016-05-16 17:20:35
Original
1214 people have browsed it

next: an element next to $('')

nextAll: all sibling elements after $('')

nextUntil: until. . . The previous meaning, so it means all sibling elements after $(''), but before the nextUntil parameter, excluding the matching element itself

sibings: all sibling elements before and after $('')

The simple understanding is that next is to find his younger brother/sister, nextAll is to find all his younger brothers/sisters, nextUntil is to find younger brothers/sisters who are a certain age younger than him, siblings is to find all his brothers/ Sister, and all his brothers/sisters. So the same peer relationship, prev, prevAll, prevUntil

The following is a simple test code

Copy code The code is as follows:





Document




hhh

This is a title



This is a test


This is a test


This is a test< ;/p>

hhha

This is a test


This is a test


< ;/div>
<script> <br>$(function(){ <br>//$('p:first').next().css('background','red'); <br>//$('p:first').nextAll().css('background','yellow'); <br>//$('p:first').nextUntil('div').css ({'font-size':20,background:'red'}); <br>//$('p:first').siblings().css('background','yellow'); <br> }); <br></script>


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template