Hey everyone,

I am looping through all the inputs on a page, then trying to get the name attribute of the element that's clicked.

var allInputs = document.getElementsByTagName('input');
        for (var i = 0; i < allInputs.length; i++) {
            if (allInputs[i].className == 'someclass') {
                allInputs[i].onmousedown = function () {
When I click on any of the inputs I get a "Uncaught TypeError: Cannot read property 'name' of undefined". What am I doing wrong?