var task = [document.getElementById('*'),
document.getElementById('+')];
var i;
var displayfield = document.getElementById('displayarea');
displayfield.disabled=true;
for(i=0;i<task.length;i++){
task[i].onclick = function(){
console.log('entered?');
displayfield.innerHTML = task[i].id;
console.log('clicked');
console.log(task[i].id.length);
}
}
i am getting this error "Cannot read property 'id' of undefined".. but when i type task[0] or task[1] in my browser console and give correct result like "*" and "+"....