Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
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.
*/

// 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);

// 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);

//- [ ] Select the section with an id of container using querySelector.
const getTheElement=document.querySelector("#container");
console.log("getTheElement",getTheElement)