getting the title of a child of an element
<p>I have a JavaScript file that prints the <code>title</code> attribute of the child <code>img</code> element inside of it.</p>

<p>In other words, I have an <code>img</code> tag inside an <code>a</code> tag. The <code>img</code> tag has a <code>title</code> attribute inside of it. I want to get that attribute.</p>

<p>Here is my JavaScript code. The <code>el</code> variable is the a element which contains the <code>img</code> element.</p>

<pre><code>c.innerHTML += x + y + "&lt;h1&gt;" + el.childNodes[0].title +"&lt;/h1&gt;" + z;
</code></pre>

<p>For some reason, however, the <code>el.childNodes[0].title</code> doesn't work. It just returns the following value:</p>

<pre><code>undefined
</code></pre>

<p>I've tried using <code>el.firstChild.title</code> as well, but it still returns the same value.</p>

<p>Here is my HTML code:</p>

<pre><code>&lt;a class="nanobox-img" href="index.html" rel="nanobox-single-override"&gt;
    &lt;img src="../../images/testnull.gif" title="This is a NanoBox Demo"/&gt;
&lt;/a&gt;
</code></pre>
