-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (38 loc) · 1.14 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
44
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QRCode generator</title>
<link rel="stylesheet" href="main.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
</head>
<body>
<div class="qr-code-generator">
<div class="item">
<input type="text" class="qr-url" placeholder="URL or Text" />
<input type="number" class="qr-size" value="128" min="20" max="500" />
<button class="generate-qr-code btn btn-primary">Generate</button>
</div>
<div id="qrcode"></div>
</div>
<script type="text/javascript">
$(".generate-qr-code").on("click", function () {
// Clear Previous QR Code
$("#qrcode").empty();
// Set Size to Match User Input
$("#qrcode").css({
width: $(".qr-size").val(),
height: $(".qr-size").val()
});
// Generate and Output QR Code
$("#qrcode").qrcode({
width: $(".qr-size").val(),
height: $(".qr-size").val(),
text: $(".qr-url").val()
});
});
// jQuery('#qrcode').qrcode("zuber1077.github.io");
</script>
</body>
</html>