Latest web development tutorials

Title text attributes

Title Object Reference Title Objects

Examples

Return to the document title tag text content:

var x = document.getElementsByTagName ( "TITLE") [0] .text;

x The output is:

HTML DOM Objects

try it"

Definitions and use

text property sets or returns the text content of the document title element.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the text attribute.


grammar

Returns text attributes:

titleObject .text

Setting text attributes:

titleObject .text = text

Property Value

value description
text It describes the text content of the title element of the document.

technical details

return value: String, returns the text content of the document title element.


More examples

Examples

Modify the document title element in the text:

document.getElementsByTagName ( "TITLE") [0] .text = "new title ..";

try it"


Title Object Reference Title Objects