-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyBtn.html
78 lines (62 loc) · 2.03 KB
/
copyBtn.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body{
background-color: blueviolet;
}
.main{
text-align: center;
}
.text{
height: 100px;
width: 100px;
border: 2px solid black;
background-color: rgb(236, 53, 166);
}
textarea{
background-color: rgb(236, 53, 166);
}
.btn{
height: 50px;
width: 70px;
background-color: blue;
border: 2px solid black;
border-radius: 10px;
}
@keyframes colorChange {
0%{
background-color: green;
}
80%{
background-color: blue;
}
}
.btn:active{
transform: scale(0.7);
animation:colorChange 5s ease-in-out none
}
</style>
<title>copyBtn</title>
</head>
<body>
<div class="main">
<br><br><br><br><br>
<textarea type="text" class="text" id="myText" placeholder="Enter Text"></textarea> <br><br><br><br><br>
<button class="btn" id="btn" onclick="copyContent()">Copy</button>
<br><br><br><br><br>
<textarea name="" id="" cols="10" rows="5"></textarea>
</div>
<script>
function copyContent(e){
const copy= document.getElementById('btn');
let text=document.getElementById('myText').value
navigator.clipboard.writeText(text);
navigator.clipboard.writeText(text);
copy.style.transition="all .3s ease-in";
}
</script>
</body>
</html>