JavaScript JavaScript and the DOM Traversing the DOM Getting the First and Last Child

Peter Theroux
Peter Theroux
5,600 Points

Button Problems

'up', 'down', and 'add item' buttons do not work. Commenting out the if statements on line 48 allows 'up' to work and likewise with line with 'down', but not at the same time. The console gives an error at line 78. Link to worksheet: https://w.trhou.se/86y59l9ml9

2 Answers

Steven Parker
Steven Parker
163,760 Points

You just have a couple of typo/spelling errors:

  • on line 46 there is "previousElementsSibling" (with an extra "s") instead of "previousElementSibling"
  • on line 54 there is "nextElementsSibling" (also with an extra "s") instead of "nextElementSibling"