-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
67 lines (50 loc) · 1.92 KB
/
index.js
File metadata and controls
67 lines (50 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
let headerTitle = document.querySelectorAll('header h1');
Array.from(headerTitle).forEach(((header) => {
header.textContent = "Fruits & Vegetables Corp";
}));
let ahref = document.querySelectorAll('ul li a[href="#bananas"]');
Array.from(ahref).forEach(((a) => {
a.textContent = "Vegetables";
a.href = "#Vegetables";
}));
let removeTd = document.querySelectorAll('table thead tr td');
for (let i = 0; i < removeTd.length; i++) {
removeTd[i].remove();
}
const thead = ['Name', 'Email'];
let th = document.createElement('th');
let th1 = document.createElement('th');
th.textContent = thead[0];
th1.textContent = thead[1];
document.querySelector("table thead tr").append(th, th1);
let deleteAbout = document.querySelectorAll('#about');
for (let i = 0; i < deleteAbout.length; i++) {
deleteAbout[i].remove();
}
let newContact = document.createElement('section');
newContact.id = "about";
document.querySelector('#main').appendChild(newContact);
let p = document.createElement('p');
p.textContent = "We're the best in fruits & vegetables";
document.querySelector('#about').appendChild(p);
let h2About = document.createElement('h2');
h2About.textContent = 'About';
document.querySelector('#about').appendChild(h2About);
let h2Contact = document.createElement('h2');
h2Contact.textContent = 'Contact';
document.querySelector('#contact').appendChild(h2Contact);
let title = document.querySelectorAll('head title');
Array.from(title).forEach(((title) => {
title.textContent = "Fruits & Vegetables Corp";
}));
let head = document.getElementsByTagName('head')[0];
let link = document.createElement('link');
link.href= "main.css";
link.rel = "stylesheet";
link.type = "text/css";
head.appendChild(link);
const contactP = document.querySelector("#contact p");
const contactTable = document.querySelector("#contact table");
const contactH2 = document.querySelector("#contact h2");
contactP.after(contactTable);
contactP.before(contactH2);