Skip to content

Commit

Permalink
Merge pull request #592 from sanjevraj-J/patch-2
Browse files Browse the repository at this point in the history
QR_Generator
  • Loading branch information
Ayushparikh-code authored Oct 29, 2024
2 parents 6107ef7 + 8a36788 commit 5914d03
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions QR_Generator.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Generator</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f7f7f7;
font-family: Arial, sans-serif;
}

.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
margin-bottom: 20px;
color: #333;
}

input {
width: 80%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
margin-bottom: 10px;
}

button {
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}

button:hover {
background-color: #0056b3;
}

#qrcode {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<h1>QR Code Generator</h1>
<input type="text" id="inputText" placeholder="Enter text or URL" />
<button id="generateButton">Generate QR Code</button>
<div id="qrcode"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
$(document).ready(function() {
$('#generateButton').on('click', function() {
const inputText = $('#inputText').val();
$('#qrcode').empty(); // Clear previous QR code

if (inputText) {
$('#qrcode').qrcode({
text: inputText,
width: 200,
height: 200
});
} else {
alert("Please enter a valid text or URL");
}
});
});
</script>
</body>
</html>

0 comments on commit 5914d03

Please sign in to comment.