<!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <title>QR Code Generator</title> <script src=”https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js”></script> <style> #qrcode { margin-top: 20px; } </style> </head> <body> <h1>QR Code Generator</h1> <form id=”qrForm” onsubmit=”return false;”> <label for=”text”>Enter text or URL:</label> <input type=”text” id=”text” name=”text” required> </form> <div id=”qrcode”></div> <script> function generateQRCode(text) { var qrcodeContainer = document.getElementById(‘qrcode’); qrcodeContainer.innerHTML = ”; // Clear previous QR code if (text.trim() !== ”) { new QRCode(qrcodeContainer, text); } } document.getElementById(‘text’).addEventListener(‘input’, function(event) { generateQRCode(event.target.value); }); </script> </body> </html>