/ 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.
From book Dom Scripting by Jeremy Keith.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getNextElement(node) { if(node.nodeType == 1) { return node; } if (node.nextSibling) { return getNextElement(node.nextSibling); } return null; }