Posted By

alberomo on 08/20/11


Tagged

javascript manual


Versions (?)

getNextElement function


 / Published in: JavaScript
 

A JS function that returns the next element of a node. Argument: The node you want to know next element.

From book Dom Scripting by Jeremy Keith.

  1. function getNextElement(node) {
  2. if(node.nodeType == 1) {
  3. return node;
  4. }
  5. if (node.nextSibling) {
  6. return getNextElement(node.nextSibling);
  7. }
  8. return null;
  9. }

Report this snippet  

You need to login to post a comment.