Remove box-shadow of input from Javascript

javascript

Solution

Array.prototype.forEach.call(document.getElementsByTagName('INPUT'), function(el) {
     el.style.boxShadow = '';
});

`getElementsByTagName` returns `NodeList`, which is sort of like an `Array`; has `length` property, and is enumerable, but has no other goodies.

And here's an alternative which you should prefer:

var elements = document.getElementsByTagName('INPUT');
var len = elements.length;
for(var i = 0; i < len; ++i) {
 elements[i].style.boxShadow = '';
}

But If I were you, I'd invest my time into learning jQuery, because of this:

$("input").css("boxShadow", "none");

Problem

I want to remove box-shadow of all input elements by javascript. I have tried this but it does not work. ``` document.getElementsByTagName('input').style.boxShadow = ''; ```

Original source