QRMaker/script.js

22 lines
545 B
JavaScript
Raw Normal View History

document.addEventListener('DOMContentLoaded', function () {
const textInput = document.getElementById('text-input');
const qrCodeContainer = document.getElementById('qrcode');
const qrCode = new QRCode(qrCodeContainer, {
text: "",
width: 256,
height: 256,
});
function updateQRCode() {
const text = textInput.value;
qrCode.clear();
if (text) {
qrCode.makeCode(text);
}
}
textInput.addEventListener('input', updateQRCode);
updateQRCode();
});