I'm testing the waters with HTML/CSS/Javascript. I have a (moderately) firm grasp of the three languages separately, it's just trying to get them to cooperate with each other that is giving me issues.
My CSS and Javascript files are linked externally to my HTML file.
I'm trying to get Javascript to save user input in a variable and show the text in an alert window.
function saveUn() {
var username = document.getElementById('un').value;
alert(username);
}
<form>
Username:
<input type="text" size="12" id="un" /><br />
<input type="submit" onclick="saveUn();" />
</form>
Any help is greatly appreciated!
UPDATE: It turns out my problem was, in fact, that I didn't insert my external Javascript file correctly. I fixed it, and now my code works just fine. Typos ruin lives, kids.