forked from valfragier16/JavaScript-DOM
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathjavaScript.js
More file actions
37 lines (19 loc) · 822 Bytes
/
javaScript.js
File metadata and controls
37 lines (19 loc) · 822 Bytes
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
document.getElementById("para1").innerHTML = "We are coders";
document.getElementById("para2").innerHTML = "We are coders";
document.getElementById("para1").innerHTML = "Developers for life!";
var img = document.createElement('img');
img.src = "lib/images/Kimberly Bryant.jpg";
var src = document.querySelector("body");
src.appendChild(img);
document.getElementById("para1").style.color = "blue";
document.getElementById("para1").style.fontSize = "40px";
var button = document.createElement('button');
button.innerHTML = 'click me';
src.appendChild(button);
button.addEventListener('click', () => {
if(img.style.display == 'none'){
img.style.display = 'block';
}else {
img.style.display = 'none';
}
});