-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOM-warmup.html
More file actions
81 lines (68 loc) · 2.32 KB
/
DOM-warmup.html
File metadata and controls
81 lines (68 loc) · 2.32 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!--it's not working for me. Why???-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DOM Warmups</title>
<!-- <style>-->
<!-- #button1:hover {-->
<!-- background-color: hotpink;-->
<!-- }-->
<!-- #button2:hover {-->
<!-- background-color: hotpink;-->
<!-- }-->
<!-- #button3:hover {-->
<!-- background-color: hotpink;-->
<!-- }-->
<!-- </style>-->
</head>
<body>
<h1 id="goodMorning">Good Morning, Draco!</h1>
<button id="afternoon">It's afternoon</button>
<section>
<button id="button1" data-number="1">Change Me</button>
<button id="button2" data-number="2">Change Me Too</button>
<button id="button3" data-number="3">Don't forget about me</button>
<p id="message"></p>
</section>
<button id="reset">Reset</button>
<section>
<input type="text" id="wordToDisplay">
<button id="displayWord">Display in DOM</button>
<p id="word"></p>
</section>
<section>
<button id="create-an-element">Create an Element</button>
</section>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossOrigin="anonymous"></script>
<script src="js/DOM-warmups.js">
<!--What is this solution for? I think this is for the warmup on Monday when we needed to change the header to say Good Afternoon, Draco!-->
// var afternoonButton = document.getElementById("afternoon"); //this is called referencing
// var header = document.getElementById("goodMorning");
// var changeHeader = function() {
// header.innerHTML = "Good Afternoon, Draco!"
// }
// afternoonButton.addEventListener('click', changeHeader => {
// };
//Javier's solution for warmup on 8/17/2021. It's not working for me!!
$("section button").hover(
function(e) {
$(e.target).css("background-color", "hotpink");
},
function(e) {
$(e.target).css("background-color", "white");
});
//Solution for warmup on 8/18/2021
// alert($("#wordToDisplay").val());
$("#displayWord").on("click", function() {
var word = $("wordToDisplay").val();
$("word").html(word);
});
$("create-an-element").on('click', function() {
$(this).after('<p>I am new</p>');
});
</script>
</body>
</html>
<!--good afternoon draco-->