Browse Source

Catch default event

master
Sven Seeberg 4 months ago
parent
commit
89079f4fb8
Signed by: sven.seeberg
GPG Key ID: 29559DD5A83806B5
  1. 7
      index.html

7
index.html

@ -11,12 +11,13 @@
<body class="text-center">
<main class="form-qrcode">
<script type="text/javascript">
function generate_qrcode() {
function generate_qrcode(e) {
e.preventDefault();
var wrapper = new QRCodeWrapper(document.getElementById("canvas"), document.getElementById("floatingInput").value);
wrapper.render();
}
</script>
<form onsubmit='generate_qrcode();'>
<form onsubmit='generate_qrcode(event);'>
<div class="form-floating">
<img class="mb-4" src="https://blog.netzbegruenung.de/files/2013/10/netzbegruenung-logo-website.png" alt="" height="57">
<h1 class="h3 mb-3 fw-normal">QR Code Generator</h1>
@ -26,7 +27,7 @@
<label for="floatingInput">Adresse / Text</label>
</div>
<button type='button' class="w-100 btn btn-lg btn-primary" onclick='generate_qrcode();'>Generieren</button>
<button type='button' class="w-100 btn btn-lg btn-primary" onclick='generate_qrcode(event);'>Generieren</button>
</form>
<div class="text-center m-4" id="qrcode" style=""><canvas id="canvas"></canvas></div>

Loading…
Cancel
Save