DOM
document.querySelector()
Learn how to use document.querySelector() in JavaScript.
document.querySelector()
Documentation for document.querySelector() in JavaScript.
Syntax
document.querySelector(".btn")
Example
// Practical usage
document.querySelector(".btn")
console.log("Executed successfully.");
Notes
JavaScript provides powerful built-in methods for the web.
Try It Yourself
You can run JavaScript directly in the BrowserCode Playground.