获取父节点

$('#test').parent()  =>  document.getElementById('test').parentNode

获取子节点

$('#test').children()


function children(elem) {
  if(elem.children) {
    return elem.children;
  } else {
    var children = [];     
    for (var i = el.children.length; i--;) {       
        if (el.children[i].nodeType != 8)      
          children.unshift(el.children[i]);    
    }
    return children;
  }
}


children(document.getElementById('test'));

获取下一个节点(兄弟节点)

$('#test').next()


function nextElementSibling(elem) {
  if(elem.nextElementSibling) {
    return elem.nextElementSibling;
  } else {
    do { 
       elem = elem.nextSibling; 
    } while ( elem && elem.nodeType !== 1 );   
    return elem;
  }
}


nextElementSibling(document.getElementById('test'));

获取上一个节点(兄弟节点)

$('#test').prev()     


function previousElementSibling(elem) {    
  if(elem.previousElementSibling) {    
    return elem.previousElementSibling;    
  } else {    
    do {     
      elem = elem.previousSibling;     
    } while ( elem && elem.nodeType !== 1 );       
    return elem;    
  }   
}     
previousElementSibling(document.getElementById('test'));