HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Click on the button to display the element immediately following this paragraph</p> <button onclick="myFunction()">Click Me</button> <p id="point"></p> <p><strong>Note</strong>: Open your console (Press F12) before clicking on the button.</p> <script> var x = document.getElementById("point"); var elem = document.getElementsByTagName("p")[0]; function myFunction(){ console.log(elem.nextElementSibling) } </script> </body> </html>
OUTPUT
×

Save as Private