0

There is a typo in lastChild

should be the las childNode

11th Sep 2017, 8:08 PM
Santiago
Santiago - avatar
2 Answers
+ 1
if your code is like that $(document).ready(function(){ var lastcommentq = document.getElementById('div').lastChild.id; alert(lastcommentq); }); Your elements probably have text nodes around them, so the last child node of the outer <div> won't necessarily have an "id" attribute. for more info please attach code
11th Sep 2017, 8:36 PM
MsJ
MsJ - avatar
0
I'm trying to communicate that if you do var x = document.getElementByTag("element") is not the same x.firstChild() than x.lastChild() like you guys writed in the correspondent lesson. At least I thought to read that.
11th Sep 2017, 8:47 PM
Santiago
Santiago - avatar