Skip to content

Instantly share code, notes, and snippets.

@fatadz
Created July 15, 2023 07:22
Show Gist options
  • Save fatadz/414e2ba5dfb31854e74416e1fdf66861 to your computer and use it in GitHub Desktop.
Save fatadz/414e2ba5dfb31854e74416e1fdf66861 to your computer and use it in GitHub Desktop.
Generate QR Code in html with javascript
<!DOCTYPE html>
<html>
<body>
<div id="qrcode"></div>
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<script>
// Get the reference to the HTML element where the QR code will be displayed
const qrcodeContainer = document.getElementById('qrcode');
// Generate the QR code
new QRCode(qrcodeContainer, {
text: 'Your text or data here', // The data to encode into the QR code
width: 128, // The width of the QR code in pixels
height: 128 // The height of the QR code in pixels
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment