You are here

8 March 2016

This snippet shows how to get element next to your element / selector. This a part of dom traversal. Using javascript for next element parsing can be used to create some powerful dynamic content. I myself used it for getting next row of table that was added there by PHP, that will be slided open when clicking on the main shown row.

Source code viewer
  1. document.getElementById('element-id').nextSibling;
  2. document.getElementById('element-id').previousSibling;
Programming Language: Javascript