Posted By


1man on 02/13/07

Tagged


Statistics


Viewed 763 times
Favorited by 2 user(s)

getNextElement DOM function


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.