HTML DOM - problem with a div
So I've this little code:
As far as I understand, the <p> inside the <div> should be its child, and in this case the first and last child. In that case, the script should alert "Hello" since it's the innerHTML of the <p> element.
Obviously I'm missing something and would love to be enlightened.
According to w3schools.com, apparently browsers other than Internet Explorer treat white spaces (including line feeds) as text nodes. See http://www.w3schools.com/dom/prop_el...firstchild.asp. So you're probably best off using a function similar to the one they give as an example in order to crawl the child elements to make sure you find the one you really want.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)