I have recently been trying to understand how to select elements and manipulate them using the html tree generator and JavaScript. How do I select the second last element of the last element child and also how do I select the links in order to manipulate them.
To select the second last element in the last element child I tried using :
document.firstElementChild.lastElementChild.lastElementChild.lastElementChild
…..but I still get a null hence cant change the element value.
2
Answers
Selecting the Second Last Element of the Last Element Child:
Selecting and Manipulating Links
You need to select the second last element of the last element child. That needs to be checked conditionally.
Refer the code below for more reference: