From 95cadf5eb118bf35fefc85d6383a17346234933b Mon Sep 17 00:00:00 2001 From: Tran Vo Date: Wed, 18 Jun 2025 11:43:47 -0400 Subject: [PATCH 1/3] first question/rewritting --- script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.js b/script.js index 5762129..a3cdafb 100644 --- a/script.js +++ b/script.js @@ -16,5 +16,5 @@ console.log("Hello! If you see this, the script is working."); */ // Try rewriting this without using querySelector -const header = document.querySelector("#container"); +const header = document.getElementById("container"); console.log("header", header); From c89332fdcc968bdffdd388a67586dfd6901e29ec Mon Sep 17 00:00:00 2001 From: Tran Vo Date: Wed, 18 Jun 2025 12:54:03 -0400 Subject: [PATCH 2/3] up to question 4 --- script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index a3cdafb..f0feff9 100644 --- a/script.js +++ b/script.js @@ -17,4 +17,13 @@ console.log("Hello! If you see this, the script is working."); // Try rewriting this without using querySelector const header = document.getElementById("container"); -console.log("header", header); +console.log("# 1 header", header); + +// Using querySelector +const headerQuery = document.querySelector("#container"); +console.log("# 2 headerQuery", headerQuery); +// select all using class name +const secondClassItems = document.getElementsByClassName("second"); +console.log("# 3 secondClassItems", secondClassItems); +//select all using with third class/inside ol tag +const thirdClassItems = document.querySelectorAll("ol .third"); From 76dacce6b2218a6ef954c4d66447bbaae0a52571 Mon Sep 17 00:00:00 2001 From: Tran Vo Date: Wed, 18 Jun 2025 13:00:17 -0400 Subject: [PATCH 3/3] change querySelectorAll to querySelector/console.log 4th question --- script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index f0feff9..8005067 100644 --- a/script.js +++ b/script.js @@ -26,4 +26,7 @@ console.log("# 2 headerQuery", headerQuery); const secondClassItems = document.getElementsByClassName("second"); console.log("# 3 secondClassItems", secondClassItems); //select all using with third class/inside ol tag -const thirdClassItems = document.querySelectorAll("ol .third"); +const thirdClassItems = document.querySelector("ol .third"); +console.log("# 4 thirdClassItems", thirdClassItems); + +