diff --git a/script.js b/script.js index 5762129..fb1e1f2 100644 --- a/script.js +++ b/script.js @@ -2,19 +2,71 @@ 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 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 all of the list items with a class of "second".*/ +const seconds = document.querySelectorAll(".second"); + +seconds.forEach((item, index) => { + console.log(`.second item ${index + 1}:`, item); +}); + + + + +/*- [ ] 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. -- [ ] 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. -*/ + + + + +- [ ] Give the li the text "four".*/ + + + + +/*- [ ] Append the li to the ul element.*/ +const ulElement = document.querySelector("ul"); +ulElement.appendChild(newLi); + + +/*- [ ] Loop over all of the lis inside the ol tag and give them a background color of "green".*/ +const olGrn = document.querySelectorAll("ol li"); +olGrn.forEach(li => { + li.style.backgroundColor = "green"; +}); +/*- [ ] Remove the div with a class of footer.*/ +footerDiv.remove(); + + // Try rewriting this without using querySelector -const header = document.querySelector("#container"); +const header = document.getElementById("container"); console.log("header", header);