From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Access elements with querySelector methods

Access elements with querySelector methods - JavaScript Tutorial

From the course: JavaScript Essential Training

Start my 1-month free trial

Access elements with querySelector methods

- [Instructor] Let's take a look at how to access elements in the DOM using JavaScript. In the exercise files for this movie, I've updated our examples so we have some actual content to work with. I've added some basic HTML and a style sheet in index.html and I've also expanded the HTML output in the template literal a little bit to make it possible to style it. I've added some classes. I've wrapped spans around the values, and I've also added an image at the top here. Looking at the project site in the browser you'll see, it looks quite different but there's nothing new here in terms of JavaScript. I've just expanded on what we've covered so far in the course. All right, anytime you want to do something in the DOM you start by finding the element or elements you want to work with. For this, we have two methods: query selector and query selector all. And they both apply to the document object. These methods use…

Contents