From 1b1c7d672be13a5063f77e2a0a0296066f05f1ab Mon Sep 17 00:00:00 2001 From: pedrosortega Date: Wed, 18 Jun 2025 12:05:28 -0400 Subject: [PATCH 1/3] solved first problem --- script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script.js b/script.js index 5762129..b2713b2 100644 --- a/script.js +++ b/script.js @@ -18,3 +18,8 @@ console.log("Hello! If you see this, the script is working."); // Try rewriting this without using querySelector const header = document.querySelector("#container"); console.log("header", header); + +// [ ] Select the section with an id of container without using querySelector. + +const noSelector=document.getElementById("container"); +console.log("noSelector",noSelector); \ No newline at end of file From 12913ba44f86cba0b0ec2bf46ca2145d93e29c7d Mon Sep 17 00:00:00 2001 From: TJordan77 Date: Wed, 18 Jun 2025 12:33:23 -0400 Subject: [PATCH 2/3] updated scrip.js to complete 4 more tasks --- script.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/script.js b/script.js index b2713b2..fcf2192 100644 --- a/script.js +++ b/script.js @@ -1,16 +1,16 @@ console.log("Hello! If you see this, the script is working."); /* -- [ ] Select the section with an id of container without using querySelector. +- [✓] Select the section with an id of container without using querySelector. - [ ] Select the section with an id of container using querySelector. - [ ] Select all of the list items with a class of "second". -- [ ] Select a list item with a class of third, but only the list item inside of the ol tag. +- [✓] Select a list item with a class of third, but only the list item inside of the ol tag. - [ ] Give the section with an id of container the text "Hello!". - [ ] Add the class main to the div with a class of footer. - [ ] Remove the class main on the div with a class of footer. -- [ ] Create a new li element. -- [ ] Give the li the text "four". -- [ ] Append the li to the ul element. +- [✓] Create a new li element. +- [✓] Give the li the text "four". +- [✓] Append the li to the ul element. - [ ] Loop over all of the lis inside the ol tag and give them a background color of "green". - [ ] Remove the div with a class of footer. */ @@ -19,7 +19,18 @@ console.log("Hello! If you see this, the script is working."); const header = document.querySelector("#container"); console.log("header", header); -// [ ] Select the section with an id of container without using querySelector. - +// Select the section with an id of container without using querySelector. const noSelector=document.getElementById("container"); -console.log("noSelector",noSelector); \ No newline at end of file +console.log("noSelector",noSelector); + +// Select a list item with a class of third, but only the list item inside of the ol tag. +const olThird = document.querySelector('ol .third'); + +// Create a new li element +const insertLi = document.createElement('li'); + +// Give the li the text "four". +insertLi.textContent = 'four'; + +// Append the li to the ul element. +document.querySelector('ul').appendChild(insertLi); \ No newline at end of file From ea8f894e8425b2b6093460131384a7d484f83492 Mon Sep 17 00:00:00 2001 From: pedrosortega Date: Wed, 18 Jun 2025 12:48:45 -0400 Subject: [PATCH 3/3] used QuerySelector --- script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index fcf2192..c4ea0d9 100644 --- a/script.js +++ b/script.js @@ -33,4 +33,8 @@ const insertLi = document.createElement('li'); insertLi.textContent = 'four'; // Append the li to the ul element. -document.querySelector('ul').appendChild(insertLi); \ No newline at end of file +document.querySelector('ul').appendChild(insertLi); + +//- [ ] Select the section with an id of container using querySelector. +const getTheElement=document.querySelector("#container"); +console.log("getTheElement",getTheElement) \ No newline at end of file