The basic point of what I'm trying to do is to create a form with radio buttons, each with their own value, and then have some Javascript print something onto the webpage depending on what was selected.
Example: User selects 1 - "You selected 1" appears under form - user selects 2 - "You selected 2" appears under form
The issue that occurs when I go to test my code is that nothing ever get's printed when I hit the submit button. I can't tell if it's not printing anything because the function isn't being called, or if it's because my syntax involved in calling a specific HTML tag is iffy, or if it's because of something else entirely. I have no desire to learn how to use any javascript libraries just yet (still trying to learn the full extent of what I can do with raw javascript) and so far, tutorial resources have been next to useless except for things like "form.preventDefault()" and "document.querySelector("input[name=radInput]:checked").value".
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,scale=1">
<script language="javascript, text">
var salt =
document.querySelector("input[name=radInput]:checked").value;
var form = document.querySelector("form");
var sand = document.querySelector("pre");
form.addEventListener("submit", function(event) {
var data = new FormData(form);
var output = "";
for (const entry of data) {
output = entry[0] + "=" + entry[1] + "\r"};
sand.innerText = output;
event.preventDefault();
}, false);
</script>
</head>
<body>
<form>
<div>
<input type="radio" id="input1" name="radInput" value="1">
<label for="input1">ONE</label>
<input type="radio" id="input2" name="radInput" value="2">
<label for="input2">TWO</label>
<input type="radio" id="input3" name="radInput" value="3">
<label for="input3">THREE</label>
</div>
<div>
<button type="submit">Test</button>
</div>
</form>
<div>
<pre></pre>
</div>
</body>
</html>