Created
July 15, 2023 07:22
-
-
Save fatadz/414e2ba5dfb31854e74416e1fdf66861 to your computer and use it in GitHub Desktop.
Generate QR Code in html with javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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