# Add ".childNodes\[0\]"

**URL:** <https://forum.kirupa.com/t/add-childnodes-0/306966>\
**Category:** flash\
**Created:** [March 25, 2010, 1:16pm UTC](https://forum.kirupa.com/t/add-childnodes-0/306966 "2010-03-25T13:16:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lillo\_\_hotmail](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@lillo\_\_hotmail](https://forum.kirupa.com/u/lillo__hotmail)\
**Post date:** [March 25, 2010, 1:16pm UTC](https://forum.kirupa.com/t/add-childnodes-0/306966/1 "2010-03-25T13:16:18Z")

</div>

Hi all!

Is there a way to add “.childNodes[0]” to a var? Like if i have:

myVar = this.firstChild.childNodes[0].firstChild.nodeValue;

And if the user push a button I want myVar to be;

myVar = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;

Have a great day!
