/ Published in: JavaScript
Released into the public domain. I haven't tested these (realized I didn't need them for what I was trying to do), but they should work. Bug fixed 7/19/2011.
Expand |
Embed | Plain Text
function previousElement(elmnt) { elmnt = elmnt.previousSibling; while(elmnt&&elmnt.nodeType!=1) elmnt = elmnt.previousSibling; return elmnt; } function nextElement(elmnt) { elmnt = elmnt.nextSibling; while(elmnt&&elmnt.nodeType!=1) elmnt = elmnt.nextSibling; return elmnt; }
You need to login to post a comment.
