I'm trying to write a simple program. I write text in a textfeild, click submit, and it shows up in the console. Sounds simple, right? I thought so too. Unfortunately, when I click submit, the page just goes blank. No errors, it just goes blank. Why is this happening? Even changing the submit button to a regular, generic button did not work.
Here is my code:
function write(){
var graffiti = document.getElementById("graffiti").value;
console.log(graffiti);
}
<!DOCTYPE html>
<html>
<head>
<script src="graffiti.js"></script>
</head>
<body>
<input type="text" id="graffiti"><br>
<input type="submit" value="submit" onclick="write()">
</body>
</html>
What's the deal?