Home  >  Article  >  Web Front-end  >  How to get nodes such as brothers and parent classes in js_javascript skills

How to get nodes such as brothers and parent classes in js_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:05:101097browse

var chils= s.childNodes; //Get all the child nodes of s

var par=s.parentNode; //Get the parent node of s

var ns=s.nextSbiling; // Get the next sibling node of s

var ps=s.previousSbiling; //Get the previous sibling node of s

var fc=s.firstChild; //Get the first one of s Child node

var lc=s.lastChile; //Get the last child node of s

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