0
There is a typo in lastChild
should be the las childNode
2 ответов
+ 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
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.