Why dynamically created html element's title is not reached by ".title"?

mmu36478

I create new html element. And initialize its value. Then when I try to reach for its title by el.title, it returns undefined. However I can reach by getElementsByTagName("title")

The example is below;

var el = document.createElement( 'html' );
el.innerHTML = "<!DOCTYPE html><html><head><title>HTML Reference</title></head><body>The content of the document......</body></html>";

console.log(el.title)
**undefined**

//but the following returns the title 
el.getElementsByTagName("title")[0].text
"HTML Reference"

Why this is happening? Why el.title returns undefined?

Quentin

The title property of an HTML element object maps on to the title attribute, it doesn't find the first title element descendant.

You would get a result if you had <html title='bad place for a title'>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to dynamically change a web page's title?

From Dev

Empty <title> element in HTML stops HTML from loading if written as <title />

From Dev

Jquery dialog, use custom html element as the title

From Dev

Bind Angularjs to newly created html element dynamically

From Dev

JavaScript get the <title> element

From Dev

How Wunderlist created a search control in the window's title bar?

From Dev

Embedding HTML anchors to title created using ODS HTML in SAS

From Dev

Get content of a <title> element in html using JavaScript

From Dev

HTML - Why doesn't my title show?

From Dev

FragmentPagerAdapter update title dynamically

From Dev

get an html element from the title of a child element

From Dev

Why BeautifulSoup is not showing the title in HTML

From Dev

Bootstrap popover title option do not override the html element title

From Dev

Change ionic title dynamically

From Dev

dynamically apply title of html document into the title fields of images

From Dev

Empty <title> element in HTML stops HTML from loading if written as <title />

From Dev

Dynamically modify title of a series

From Dev

How get value of a dynamically created HTML element?

From Dev

Embedding HTML anchors to title created using ODS HTML in SAS

From Dev

Get content of a <title> element in html using JavaScript

From Dev

Dynamically add title attribute to URL in HTML

From Dev

Html change document's title

From Dev

Why does this dynamically created element not bound to an event?

From Dev

referencing a dynamically created element in html

From Dev

Why BeautifulSoup is not showing the title in HTML

From Dev

Get the .html of a dynamically created element's descendant's child with jquery?

From Dev

Changing content of a HTML element's 'title' attribute used for tooltip, using jquery or css

From Dev

Why the hover on the title it's not showing?

From Dev

How to set title attribute for HTML element dynamically?

Related Related

  1. 1

    How to dynamically change a web page's title?

  2. 2

    Empty <title> element in HTML stops HTML from loading if written as <title />

  3. 3

    Jquery dialog, use custom html element as the title

  4. 4

    Bind Angularjs to newly created html element dynamically

  5. 5

    JavaScript get the <title> element

  6. 6

    How Wunderlist created a search control in the window's title bar?

  7. 7

    Embedding HTML anchors to title created using ODS HTML in SAS

  8. 8

    Get content of a <title> element in html using JavaScript

  9. 9

    HTML - Why doesn't my title show?

  10. 10

    FragmentPagerAdapter update title dynamically

  11. 11

    get an html element from the title of a child element

  12. 12

    Why BeautifulSoup is not showing the title in HTML

  13. 13

    Bootstrap popover title option do not override the html element title

  14. 14

    Change ionic title dynamically

  15. 15

    dynamically apply title of html document into the title fields of images

  16. 16

    Empty <title> element in HTML stops HTML from loading if written as <title />

  17. 17

    Dynamically modify title of a series

  18. 18

    How get value of a dynamically created HTML element?

  19. 19

    Embedding HTML anchors to title created using ODS HTML in SAS

  20. 20

    Get content of a <title> element in html using JavaScript

  21. 21

    Dynamically add title attribute to URL in HTML

  22. 22

    Html change document's title

  23. 23

    Why does this dynamically created element not bound to an event?

  24. 24

    referencing a dynamically created element in html

  25. 25

    Why BeautifulSoup is not showing the title in HTML

  26. 26

    Get the .html of a dynamically created element's descendant's child with jquery?

  27. 27

    Changing content of a HTML element's 'title' attribute used for tooltip, using jquery or css

  28. 28

    Why the hover on the title it's not showing?

  29. 29

    How to set title attribute for HTML element dynamically?

HotTag

Archive