Having trouble with a 'value' of null error that is not getting resolved even after
window.onload = function(){
Any suggestions on what to do? Here's the code snippet:
window.onload = function(){
var shashank = document.getElementById('shashank').value;
var kiran = document.getElementById('kiran').value;
var sumanth = document.getElementById('sumanth').value;
var arun = document.getElementById('arun').value;
var arr = [shashank,kiran,sumanth,arun];
document.getElementById('btn').addEventListener('click', showName);
}
This is the html structure being used:
<html>
<head>
<title>Attendance Sheet</title>
<script src="app.js"></script>
<style>
#present{
width:50px;
height:50px;
}
</style>
</head>
<body>
<select>
<option value="shashank">Shashank</option>
<option value="kiran">Kiran</option>
<option value="sumanth">Sumanth</option>
<option value="arun">Arun</option>
</select>
<button id="present">P</button>
<button id="btn">Submit</button>
</body>
</html>