-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattributes-and-css.html
More file actions
66 lines (46 loc) · 1.12 KB
/
attributes-and-css.html
File metadata and controls
66 lines (46 loc) · 1.12 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Attributes and CSS</title>
</head>
<body>
<h1 id="main">Header</h1>
<p>Some content.</p>
<h2>Sub-Header</h2>
<p>Some more content.</p>
<h1>NewHeader</h1>
<h1>Extra New Header</h1>
<script
src="https://code.jquery.com/jquery-3.6.1.min.js"
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ="
crossorigin="anonymous">
</script>
<script>
var header = $('#main').html();
var subHeader = $('h2').html();
/*$('h2').click(function() {
confirm(`This is my sub-header. ${subHeader}`);
$('#main').click(function() {
alert(header);
});
//$('h1').css('color', 'brown').css('background-color', 'papayawhip');
/*var h1Style = {
'color': 'brown',
'border': '1px solid'
}
$('h1').hover(function() {
$('this').css(h1Style);
}, function() {
$('h1').css('color', 'brown')
})
});*/
$('h2').click(function(){
$('this').addClass('subHead');
console.log('h2');
})
console.log($('h2'))
</script>
</body>
</html>