Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
query
selector
method

The HTML document.querySelector() method

Educative Answers Team

The querySelector() method returns the first element that matches a specified CSS selector (such as ID, class name, or type) in a document. If multiple elements have the same selector, then only the first one is returned.

Consider the following code snippet,​ which demonstrates the usage of the querySelector() method:

  • HTML

RELATED TAGS

html
query
selector
method
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring