/ Published in: JavaScript
                    
                                        
Useful function for CSS DOM, returns the next element after the selected node. So you could style the element directly after a h1 element for example.
                
                            
                                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;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                