lastChild (or lastElementChild) undefined in javascript
<p>So recently I began playing around with the DOM stuff, which is obviously important to know. Tried to do a simple script that paints the last element of a <code>div</code>
There's HTML. AFAIK the last child element of the <code>div</code> is that <code>span</code> element near the bottom</p>

<pre><code>&lt;div id="java"&gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
&lt;span&gt;Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>There's the js line that paints the last child blue</p>

<pre><code>document.getElementById("java").lastChild.innerHTML.style.color = "blue";
</code></pre>

<p>So the problem is that I'm getting <code>Cannot set property 'color' of undefined</code> error even when I use <code>lastElementChild</code> like I was advised before.
Is there anything I missed? I mean, of course there is, but what is that and how can I get this to work using <code>lastChild</code>?</p>