Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6651145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:58:32+00:00 2026-05-26T00:58:32+00:00

just reading the W3schools HTML DOM tutorial. There’s a paragraph that makes no sense

  • 0

just reading the W3schools HTML DOM tutorial. There’s a paragraph that makes no sense to me.

The bit that doesn’t make sense to me is:

A common error in DOM processing is to expect an element node to contain text.

However, the text of an element node is stored in a text node.

In this example: <title>DOM Tutorial</title>, the element node <title>, holds a text node with the value “DOM Tutorial”.

“DOM Tutorial” is not the value of the <title> element!

However, in the HTML DOM the value of the text node can be accessed by the innerHTML property.

Ok, what? That sounds exactly the opposite of what I though.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:58:33+00:00Added an answer on May 26, 2026 at 12:58 am

    When a markup document is converted into a DOM, you end up with a tree of nodes.

    There are several types of nodes, including elements, text and comments.

    Nodes have properties. e.g. an HTMLInputNode will have a value property that maps on to its current value. Any HTMLElementNode will have a style property through which the CSS properties defined via the style attribute can be accessed. Likewise, it will also have a className property that maps onto the class attribute.

    When you have <title>DOM Tutorial</title> you have a HTMLTitleNode containing a TextNode. To get the text DOM Tutorial you should access the TextNode and then read its data property.

    myTitle.firstChild.data
    

    And then W3Schools muddies the water by mentioning innerHTML.

    innerHTML is a property (although not a standard DOM property (I think HTML 5 is in the process of defining it)) of HTMLElementNodes which gives you a serialisation of the HTML contents of an element (but not the element itself).

    Since there is only a TextNode inside a title element, you end up with plain text there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just reading this thread and it occurred to me that there is
Just reading 21.3.6.1 basic_string::find - and there is no mention that the pos argument
I was just reading that there is a feature in AWStats that can estimate
I was just reading More proof that enterprises love Node.js and wondering: Should enterprise
I was just reading a bit about the HQ9+ programming language: https://esolangs.org/wiki/HQ9+ , https://en.wikipedia.org/wiki/HQ9+
Just reading spring in action, and I know there is a chapter on MVC
I was just reading a Java 7 preview presentation (pdf) and there was a
I am just reading a great tutorial about threads and have a problem with
I was just reading TCP/IP Illustrated and found that one of the ways to
I was just reading about how Google Go makes each thread with a reduced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.