-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
43 lines (38 loc) · 1.26 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Generator</title>
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<header>
<h1>QR Code Generator</h1>
<p>Enter urls and any text to create QR Code</p>
</header>
<div class="form">
<input type="text" placeholder="Type here">
<button>Generate QR</button>
</div>
<div class="qr-code active">
<h2></h2>
<img src="#" alt="qrcode">
</div>
</div>
<script >
const wrapper = document.querySelector(".wrapper");
const generateBtn = document.querySelector(".form button");
const qrInput = document.querySelector(".form input");
const qrImg = document.querySelector(".qr-code img");
const qrError = document.querySelector(".qr-code h2");
generateBtn.addEventListener("click", () => {
let qrValue = qrInput.value;
if(!qrValue)return;
qrImg.src = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${qrValue}`;
wrapper.classList.add("active");
});
</script>
</body>
</html>