-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.html
53 lines (43 loc) · 1.27 KB
/
scratch.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>
<div id="container">
<button id="1">Click Me</button>
<button id="2">Click Me</button>
<button id="3">Click Me</button>
</div>
<script>
const buttons = document.querySelectorAll('button');
buttons.forEach((button) => {
button.addEventListener('dblclick', () => {
console.log(button.id);
});
});
function createSomeStuff() {
const container = document.querySelector('#container');
const redcontent = document.createElement('p');
redcontent.textContent = "Hey, I'm red!";
redcontent.style.color = 'red';
container.appendChild(redcontent);
const blueh3 = document.createElement('h3');
blueh3.textContent = "I'm a blue h3!";
blueh3.style.color = 'blue';
container.appendChild(blueh3);
const mydiv = document.createElement('div');
const myp = document.createElement('p');
const myh1 = document.createElement('h1');
myh1.textContent = "I'm in a div";
myp.textContent = "ME TOO!";
mydiv.style.border = 'solid 2px black';
mydiv.style.backgroundColor = 'pink';
mydiv.appendChild(myh1);
mydiv.appendChild(myp);
container.appendChild(mydiv);
};
</script>
</body>
</html>