javascript - selecting second element child java-script -
alight have 4 containers, when click button in container popup shows image , heading of container clicked on worked out how image cant heading second element child in container. please note school assignment , can use html css , java-script. please no hate im new this. here code please help
document.getelementbyid('bigimage').src = this.parentnode.firstelementchild.src; document.getelementbyid('title').textcontent = this.parentnode.second elementchild.textcontent;
var element = document.getelementbyid('bigimage'); var parentelement = element.parentelement; parentelement.children[0]; // <- first child parentelement.children[1]; // <- second child
Comments
Post a Comment