Home  >  Article  >  Web Front-end  >  javascript nextSibling 与 getNextElement(node) 使用介绍_基础知识

javascript nextSibling 与 getNextElement(node) 使用介绍_基础知识

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

1. nextSibing:下一个节点,节点类型可以是任何一种,其中就有文本节点。

2.得到下一个元素节点:

复制代码 代码如下:

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