Hi all. I'm not exactly sure what I'm doing wrong, but when I try to use the document.getEle mentById() method, it's not working. Here's what I have:
(I am aware that I don't use braces in standard format, it just helps me keep track of what I'm doing)
When I click the button, the only thing it returns is null. Am I doing something wrong?
Code:
var username = document.getElementById('username')
function test()
{
document.write(username)
}
...
Username: <input type="text" id="username">
<input type="button" value="test" onClick="test();">
When I click the button, the only thing it returns is null. Am I doing something wrong?
Comment