Using JavaScript, I'm looking to automatically put a dollar sign in front of the entered amount in an input field within a form. I'm using the below code, but am not sure what I'm missing:
<!DOCTYPE html>
<head>
<title>Example</title>
<script>
var test = document.getElementById("name");
document.write("$"+test.value);
</script>
</head>
<body>
<form action="" method="get">
<input type="text" id="name"/>
</form>
</body>
</html>
Any help is appreciated. Thanks!