The querySelector() method returns the first child element that matches a specified CSS selector(s) of an element . Note: The querySelector() method only returns the first element that matches the specified selectors. To return all the matches, use the querySelectorAll() method instead.