-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
17 lines (16 loc) · 711 Bytes
/
script.js
File metadata and controls
17 lines (16 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const inputValue = document.querySelector('#inputValue');
const btnValue = document.querySelector('#btnValue');
const imgQrCode = document.querySelector('#imgQrCode');
const wrapper = document.querySelector('.wrapper');
let valueDefault;
btnValue.addEventListener('click', () => {
let qrcodeValue = inputValue.value.trim();
if(!qrcodeValue || qrcodeValue === valueDefault) return;
valueDefault = qrcodeValue;
btnValue.innerText = 'Gerando QR Code...'
imgQrCode.src = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${valueDefault}`
imgQrCode.addEventListener('load', () => {
wrapper.classList.add('active');
btnValue.innerText = 'Gerar QRCode'
})
})