Skip to content

Commit

Permalink
update warn feat
Browse files Browse the repository at this point in the history
  • Loading branch information
ghasemizade committed Mar 24, 2024
1 parent d23e47b commit 2e60ede
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ const $ = document
const inputElem = $.querySelector('input')
const btnElem = $.querySelector('.btn-gen')
const imgElem = $.querySelector('.qr-img')

const warnElem = $.querySelector('.warn')
const request = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data="

btnElem.addEventListener('click', ()=>{
if (inputElem.value === "") {

warnElem.innerHTML = "Fill input!"
warnElem.style.color = "red"
warnElem.style.textAlign = "center"
setTimeout(() => {
warnElem.innerHTML = ""
}, 2000);
} else{
let inputValue = inputElem.value.trim()
let qrUrl = request + inputValue
Expand Down

0 comments on commit 2e60ede

Please sign in to comment.