Posted By

1man on 02/13/07


Tagged

css DOM


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

dmarten
shachi
vali29


getNextElement DOM function


 / 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.

  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.