You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>Generate QR</title><linkrel="stylesheet" href="style.css"><scriptsrc="script.js"></script></head><body><divclass="container"><p>Enter your Text or URL</p><inputtype="text" placeholder="Text or URL" id="userInput" /><br><divid="qrBox"><imgid="qrImage" src="" /></div><!--to display the QR code --><buttonclass="generateBtn" id="generateBtn" onclick="generateQRCode()">Generate</button></div></body></html>
Javascript
functiongenerateQRCode(){letuserInput=document.getElementById('userInput');letqrBox=document.getElementById('qrBox');letqrImage=document.getElementById('qrImage');if(userInput.value==""){alert("Please enter a Text or URL");}else{qrImage.src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data="+userInput.value;}}