O que seria esse erro?
Uncaught TypeError: campos[0].focus is not a function
at HTMLFormElement.<anonymous>
Meu Código
var campos = [
document.querySelector('#data'),
document.querySelector('#quantidade'),
document.querySelector('#valor')
];
console.log(campos);
var tbody = document.querySelector('table tbody');
document.querySelector('.form').addEventListener('submit', function(event) {
event.preventDefault();
var tr = document.createElement('tr');
campos.forEach(function (campo) {
var td = document.createElement('td');
td.textContent = campo.value;
tr.appendChild(td);
});
var tdVolume = document.createElement('td');
tdVolume.textContent = campos[1].value * campos[2].value;
tr.appendChild(tdVolume);
tbody.appendChild(tr);
campos[0] = '';
campos[1] = 1;
campos[2] = 0;
campos[0].focus();
});
Erro no Chrome