What does document.title do | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does document.title do

9th Apr 2021, 10:57 PM
rewfsgdf
rewfsgdf - avatar
2 Answers
+ 7
Accesses the value between the title tags <head> <title>Gets this text</title> </head> Try to console.log(document.title) Note: Make sure the page has loaded before you try to access the DOM. You can also set the value using; document.title = "Page Title";
9th Apr 2021, 11:13 PM
ChaoticDawg
ChaoticDawg - avatar
10th Apr 2021, 12:06 AM
Calviղ
Calviղ - avatar