From 3d68a16f321fff1965c65f93910fec575c373278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdurrahman=20Ayy=C4=B1ld=C4=B1z?= Date: Wed, 31 Aug 2022 01:29:08 +0300 Subject: [PATCH] Update 21_day_dom.md --- 21_Day_DOM/21_day_dom.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/21_Day_DOM/21_day_dom.md b/21_Day_DOM/21_day_dom.md index af46260..1b84c9f 100644 --- a/21_Day_DOM/21_day_dom.md +++ b/21_Day_DOM/21_day_dom.md @@ -141,7 +141,7 @@ let firstTitle = document.querySelector('.title') // select the first available **_querySelectorAll_**: can be used to select html elements by its tag name or class. It returns a nodeList which is an array like object which supports array methods. We can use **_for loop_** or **_forEach_** to loop through each nodeList elements. ```js -const allTitles = document.querySelectorAll('h1') # selects all the available h1 elements in the page +let allTitles = document.querySelectorAll('h1') // selects all the available h1 elements in the page console.log(allTitles.length) // 4 for (let i = 0; i < allTitles.length; i++) { @@ -149,7 +149,7 @@ for (let i = 0; i < allTitles.length; i++) { } allTitles.forEach(title => console.log(title)) -const allTitles = document.querySelectorAll('.title') // the same goes for selecting using class +allTitles = document.querySelectorAll('.title') // the same goes for selecting using class ``` ### Adding attribute