<!DOCTYPE html>
<html>
  <head>
    <title>Generate QR Code</title>
    <script src="https://cdn.jsdelivr.net/npm/qrcode-generator/qrcode.js"></script>
  </head>

  <body>
    <input type="text" id="qrInput">
    <button onclick="generateQR()">Generate QR Code</button>
    <div id="qrCode"></div>

    <script>
      function generateQR() {
        var qrInput = document.getElementById("qrInput").value;

        if (qrInput == "") {
          alert("Please enter some text to generate a QR code.");
          return;
        }

        var qr = qrcode(0, "L");
        qr.addData(qrInput);
        qr.make();
        
        var qrCodeDiv = document.getElementById("qrCode");
        qrCodeDiv.innerHTML = qr.createSvgTag({ margin: 4 });
      }
    </script>
  </body>
</html>