Hello!
I have the following problem. I have programmed a Qr Code generator. Now when I click on the Button "Click Me!" a new QR-Code should be generated and replace the old one. Unfortunately it doesn't replace the old Qrcode but puts the new one under it.
here is my HTML and JS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initialscale=1">
</head>
<body>
<select name= "Bauart" id= "qr-data">
<option value="1">test</option>
<option value="ad">test 2</option>
</select>
<button onclick="myFunction()">Click me</button>
<div id="qrcode"></div>
<br>
</body>
<script src="qrcode.min.js"></script>
<script src="javascript.js"></script>
</html>
and here is the JS
function myFunction() {
var qrdata = document.getElementById('qr-data').value;
var qrcode = new QRCode(document.getElementById('qrcode'));
qrcode.makeCode(qrdata);
}