I'm applying a injection in the address bar of the web browser , on the page of a video on youtube, in which I want to extract the date of the posting of the same.
If we open this link we see a div
similar to this:
Whenweselectthepostdateandthenusethe"View Selection Source" tool available in the web browser itself, we can see the source code for the selected line:
Giventhenameoftheclasswatch-time-text
,Itriedthefollowing:
javascript:postado=document.getElementsByClassName("watch-time-text").innerHTML; alert(postado);
And the following occurred:
Whydoesthisundefined
evenoccuronthepage?
Becauseagifisworthathousandwords