Node.prototype.nextSibling
Like a teacher named as: "Li Lei Han Meimei back up to answer the next question."
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div id="id1">李雷</div><div id="id2">韩梅梅</div> <script> document.getElementById('id1').nextSibling === document.getElementById('id2'); // true document.getElementById('id1').nextSibling.firstChild.nodeValue; // 韩梅梅 </script> </body> </html>
If there is no sibling node after the current node, that .nextSibling returns null.
Note that if there's no two div in a row, that .nextSibling get will be a line break, not only because .nextSibling effective element nodes, the nodes also valid for comment / text node.