jquery Next Nextall Nextuntil Siblings's difference introduction _jquery

Source: Internet
Author: User
Next: An element adjacent to $ (')

Nextall: All sibling elements after $ (')

Nextuntil:until have until ... Before the meaning, so he represents $ (") all subsequent sibling elements, but to the Nextuntil parameter, does not include the matching element itself

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

A simple understanding is that next is to find his brother/sister, Nextall is to find all his younger brother/sister, Nextuntil is to find a younger brother/sister than his younger, siblings is to find all his brother/sister, and all his brother/sister. So the same peer relationship, Prev,prevall, Prevuntil

The following is a simple test code
Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<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>
<body>
<div class= "a" >
<a href= "#" >hhh</a>
<p> this is a test</p>
<p> this is a test</p>
<p> this is a test</p>
<p> this is a test</p>
<div>hhha</div>
<p> this is a test</p>
<p> this is a 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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.