I am trying to select few elements into my html page and I'm wondering why I should use all the time that "document" when I'm targeting html elements for example:
//variable body
var content = document.getElementsByTagName("body");
in next variable why I cannot use something like: get all p tags from body
var selector = content.querySelectorAll("p");
instead of using
var selector = document.querySelectorAll("p");