Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Ali haider js week 3 #83

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
In Class DOM Practice is Completed.
  • Loading branch information
AliHaider-1 committed Aug 25, 2020
commit f4f02821063a1423dc0e3a56cc8f0a6ef06556e4
19 changes: 18 additions & 1 deletion Week-3/InClass/DOM-practice/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ console.log("Testing JS file loaded!")
// Task 1

// Without changing any of the HTML or CSS, update the <section> tags so that they have white backgrounds.

let getSection = document.querySelectorAll("section");
for(var i=0;i<getSection.length;i++){
getSection[i].style.backgroundColor ="white";
}



Expand All @@ -12,6 +15,11 @@ console.log("Testing JS file loaded!")
// Task 2

// Without changing any of the HTML or CSS, update the images on the page so that they are all centered.
let getImages =document.querySelectorAll("img");
for(var i=0;i<getImages.length;i++){
getImages[i].className = "content-title";
}


// Hint: look at the CSS to see if there are any classes already written which you can use.

Expand All @@ -23,3 +31,12 @@ console.log("Testing JS file loaded!")
// Task 3

// Google the date of birth and death of each of the people on the page. Without changing any of the HTML or CSS, add this in a paragraph to the end of their <section>.
let dateOfBirth = ["9-12-1906","26-8-1918","10-12-1815"];
let dateOfDeath = ["1-1-1992", "24-2-2020", "27-11-2020"];


for(var i=0;i<getSection.length;i++){
let newP = document.createElement("p");
newP.textContent = "Date of Birth is "+dateOfBirth[i]+" and Date of Death is "+dateOfDeath[i];
getSection[i].appendChild(newP);
}