-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path9.0_DOM.html
36 lines (26 loc) · 943 Bytes
/
9.0_DOM.html
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
<!DOCTYPE html>
<html>
<head>
<title>DOM - Document Object Model</title>
</head>
<body>
<button>hello</button>
<button class="js-button">second button</button>
<script>
// console.log(document.title);
// document.title='changed';
// console.log(document.body);
// console.log(typeof document.body);
// console.log(document.body.innerHTML);
// document.body.innerHTML = '<button>Good job!</button>';
//document.querySelector)
// - lets us get any element from the page and put it inside JavaScript
console.log(document.querySelector('button').innerHTML);
document.querySelector('button').innerHTML = 'changed';
const buttonElement = document.querySelector('.js-button');
console.log(buttonElement);
// document.body.innerHTML='hello'; //document object is linked to the web page
// document.title = 'Good job!'; // that's why it is called DOM
</script>
</body>
</html>