-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappday14.js
32 lines (28 loc) · 1023 Bytes
/
appday14.js
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
const list = document.querySelector('ul.collection');
const listitem = document.querySelector('li.collection-item');
var val = list.childNodes[0];
val = list.firstElementChild;
val = list.lastElementChild;
val = listitem.parentElement.parentElement;
val = list.childElementCount;
val = listitem.nextElementSibling;
// console.log(val);
// console.log(list);
// console.log(listitem);
// creating an element
const li = document.createElement('li');
li.className = 'collection-item';
const textelement = document.createTextNode('One more element');
li.append(textelement);
document.querySelector('ul.collection').appendChild(li);
//
// const link = document.createElement('a');
// link.innerHTML = "<h1>here</h1>";
// li.appendChild(link);
//
const newHeading = document.createElement('h5');
newHeading.append(document.createTextNode("Tasks"));
const oldHeading = document.getElementById('task-heading');
const div = document.querySelector('.heading');
div.replaceChild(newHeading, oldHeading);
console.log(oldHeading);