siblings() next() nextAll() nextUntil() prev() prevAll() prevUntil() 在 DOM 树中水平遍历
$(document).ready(function(){
$("h2").siblings();
});
拿到h2标签的所有的同级元素什么标签都可以
$(document).ready(function(){
$("h2").siblings("p");
});
拿到h2标签的所有的同级p标签元素
$(document).ready(function(){
$("h2").next();
});
拿到h2标签的同级的下一个元素
$(document).ready(function(){
$("h2").nextAll();
});
拿到h2标签的同级的后面的所有元素
$(document).ready(function(){
$("h2").nextUntil("h6");
});
拿到h2标签后面的和h6前面的所有的元素
浙公网安备 33010602011771号