<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>

<div class="form">
  <div class="title">QR Code Generator</div>
    <input type="text" id="website" name="website" placeholder="https://amer.savandbros.com" required/>
  <div id="qrcode-container">
    <div id="qrcode" class="qrcode"></div>
  </div>
    <button type="button" onclick="generateQRCode()">Generate</button>
</div>
.form {
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
  font-family: Helvetica, sans-serif;
  max-width: 400px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 16px;
  background: #eee;
}

.title {
  background: #2980b9;
  text-align: center;
  font-weight: bold;
  font-size: 20px;
  padding: 16px;
  border-top-right-radius: 16px;
  border-top-left-radius: 16px;
  margin: -16px -16px 16px -16px;
  color: #fff;
}

input {
  box-sizing: border-box;
  width: 100%;
  background: #fff;
  margin-bottom: 16px;
  border: 1px solid #ccc;
  padding: 16px;
  color: #555;
}

input:focus {
  outline: none;
}

button {
  width: 100%;
  padding: 16px;
  border: none;
  background: #2980b9;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  font-size: 20px;
  border-radius: 16px;
}

button:hover {
  opacity: 0.8;
}

.qrcode {
  margin-bottom: 16px;
}

.qrcode img {
  margin: 0 auto;
}

#qrcode-container {
  display: none;
}
function generateQRCode() {
  let website = document.getElementById("website").value;
  
  if (website) {
    let qrcodeContainer = document.getElementById("qrcode");
    qrcodeContainer.innerHTML = "";
    new QRCode(qrcodeContainer, website);
    document.getElementById("qrcode-container").style.display = "block";
  } else {
    alert("Please enter a valid URL");
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.