22 lines
545 B
JavaScript
22 lines
545 B
JavaScript
|
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();
|
||
|
});
|