Jquery next nextAll nextUntil siblings
- 2020-03-26 21:22:50
- OfStack
Next: an element next to $(")
NextAll: all peer elements after $(")
-leonard: not until... Before, so he says all peer elements after $("), but not the matching element itself until the nextUntil parameter
Sibings: all peer elements before and after $(")
Next is to find his younger brothers/sisters, nextAll is to find all his younger brothers/sisters, nextAll is to find his younger brothers/sisters, nextUntil is to find his younger brothers/sisters of a certain age. So the same kind of peer relationship, prev, prevAll, prevUntil
Here is the simple test code
NextAll: all peer elements after $(")
-leonard: not until... Before, so he says all peer elements after $("), but not the matching element itself until the nextUntil parameter
Sibings: all peer elements before and after $(")
Next is to find his younger brothers/sisters, nextAll is to find all his younger brothers/sisters, nextAll is to find his younger brothers/sisters, nextUntil is to find his younger brothers/sisters of a certain age. So the same kind of peer relationship, prev, prevAll, prevUntil
Here is the simple test code
<!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> This is a title </h1>
<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>
</html>