<div id='id1'> <div id='id2'> child div 1 </div> text <div id='id3'> child div 2 </div> </div> <script> alert(document.querySelector('#id2').nextSibling.data); </script>