Get element by id

var element = document.getElementById(id);

Get all elements by css selector

var nodeList = document.querySelectorAll(".some > css.selector")

Also woks for elements

var nodeList = element.querySelectorAll(".some > css.selector")

Get first element by selector

var element = document.querySelector(".some > css.selector")

Also helpful

var nodeList = document.getElementsByClassName("classname")
var nodeList = document.getElementsByTagName("div")
var nodeList = document.getElementsByName("element-name-value")