Repository navigation
Expand file tree
/
Copy path10-subscribe-button.html
More file actions
59 lines (56 loc) · 1.73 KB
/
Copy path10-subscribe-button.html
File metadata and controls
59 lines (56 loc) · 1.73 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
<!DOCTYPE html>
<html>
<head>
<title>DOM Projects</title>
<style>
.js-subscribe-button{
background-color: black;
font-size: 20px;
color: white;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
border: none;
border-radius: 15px;
font-weight: bold;
cursor: pointer;
}
.is-subscribed{
background-color: gray;
color: black;
font-size: 20px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
border: none;
border-radius: 15px;
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
<p style="
font-size: 25px;
">YouTube Subscribe Button</p>
<button onclick ="
Subscribe();
"
class="js-subscribe-button">Subscribe</button>
<script>
function Subscribe(){
const buttonELement = document.querySelector('.js-subscribe-button');
if (buttonELement.innerHTML ==='Subscribe'){
buttonELement.innerHTML = 'Subscribed';
buttonELement.classList.add('is-subscribed');
}
else{
buttonELement.innerHTML = 'Subscribe'
buttonELement.classList.remove('is-subscribed')
}
}
</script>
</body>
</html>