Once a reference to an element is gained by use of a method like getElementById or querySelector, there is the parentElement property of the elements parentElement if it has one.
In the event that the element does not have a parent element, or the parent element is not a DOM element the property will have a value of null.
Another option is the parent node property, this works in more or less the same way as parentElement but with one note worth difference. If there is a non DOM element node of sorts it will give that in place of what would otherwise be a null value.
As of this writing there is no css selector that I know of that can be used to get a parent element, so there is no way of getting a parent element with querySelector. There is of course chatter about possible future selectors and pseudo classes that might be a way to do so, but so far nothing solid or well supported.