I'm having some trouble with my javascript, it's supposed to print out whatever information you write into the form, and it does, but then it disappears right away. Can't figure out what I've done wrong here, please help!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Javascript</title>
</head>
<body>
<h1>Personal Data</h1>
<p>Fill in your name in the form below:</p>
<form>
<fieldset>
First name <input id="fname" type="text"><br>
Last name <input id="lname" type="text"><br>
Age <input id="age" type="number" value="0"><br>
<button onclick="myFunction()">Click</button><br>
<p id="demo"></p>
<script>
function myFunction() {
var age = document.getElementById("age").value;
var lname = document.getElementById("lname").value;
var fname = document.getElementById("fname").value;
document.getElementById("demo").innerHTML = "<p>My name is " + fname + " " + lname + " and I am " + age + " years old!</p>";
}
</script>
</fieldset>
</form>
</body>
</html>