File tree 1 file changed +86
-0
lines changed
1 file changed +86
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > QR Code Generator</ title >
7
+ < style >
8
+ body {
9
+ display : flex;
10
+ justify-content : center;
11
+ align-items : center;
12
+ height : 100vh ;
13
+ margin : 0 ;
14
+ background-color : # f7f7f7 ;
15
+ font-family : Arial, sans-serif;
16
+ }
17
+
18
+ .container {
19
+ text-align : center;
20
+ background : white;
21
+ padding : 20px ;
22
+ border-radius : 8px ;
23
+ box-shadow : 0 2px 10px rgba (0 , 0 , 0 , 0.1 );
24
+ }
25
+
26
+ h1 {
27
+ margin-bottom : 20px ;
28
+ color : # 333 ;
29
+ }
30
+
31
+ input {
32
+ width : 80% ;
33
+ padding : 10px ;
34
+ border : 1px solid # ddd ;
35
+ border-radius : 5px ;
36
+ margin-bottom : 10px ;
37
+ }
38
+
39
+ button {
40
+ padding : 10px 20px ;
41
+ border : none;
42
+ border-radius : 5px ;
43
+ background-color : # 007bff ;
44
+ color : white;
45
+ cursor : pointer;
46
+ transition : background-color 0.3s ;
47
+ }
48
+
49
+ button : hover {
50
+ background-color : # 0056b3 ;
51
+ }
52
+
53
+ # qrcode {
54
+ margin-top : 20px ;
55
+ }
56
+ </ style >
57
+ </ head >
58
+ < body >
59
+ < div class ="container ">
60
+ < h1 > QR Code Generator</ h1 >
61
+ < input type ="text " id ="inputText " placeholder ="Enter text or URL " />
62
+ < button id ="generateButton "> Generate QR Code</ button >
63
+ < div id ="qrcode "> </ div >
64
+ </ div >
65
+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js "> </ script >
66
+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js "> </ script >
67
+ < script >
68
+ $ ( document ) . ready ( function ( ) {
69
+ $ ( '#generateButton' ) . on ( 'click' , function ( ) {
70
+ const inputText = $ ( '#inputText' ) . val ( ) ;
71
+ $ ( '#qrcode' ) . empty ( ) ; // Clear previous QR code
72
+
73
+ if ( inputText ) {
74
+ $ ( '#qrcode' ) . qrcode ( {
75
+ text : inputText ,
76
+ width : 200 ,
77
+ height : 200
78
+ } ) ;
79
+ } else {
80
+ alert ( "Please enter a valid text or URL" ) ;
81
+ }
82
+ } ) ;
83
+ } ) ;
84
+ </ script >
85
+ </ body >
86
+ </ html >
You can’t perform that action at this time.
0 commit comments