Javascript Reference - HTML DOM title Property








The title property returns the title of the current document.

Syntax

document.title

Browser Support

title Yes Yes Yes Yes Yes

Example

The following code shows how to get the title of the current document


<!DOCTYPE html>
<html>
<head>
<title>My title</title>
</head><!--from w  w  w .  j av a2 s . c om-->
<body>

The title of the document is: 
<script>
document.write(document.title);
</script>

</body>
</html>

The code above is rendered as follows: