Home >Web Front-end >JS Tutorial >Introduction to using javascript nextSibling and getNextElement(node)_Basic knowledge

Introduction to using javascript nextSibling and getNextElement(node)_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:00:571661browse

1. nextSibing: The next node, the node type can be any type, including text nodes.

2. Get the next element node:

Copy the code The code is as follows:

function getNextElement(node){
if(node.nodeType == 1){
return node;
}
if(node.nextSibling){
return getNextElement(node.nextSibling );
}
return null;
}
Statement:
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