var elements = document.querySelectorAll('#allparam > .param input:first-child '); var sumstat = 0 for (var i=0; i<elements.length; i++) { var ttt= parseInt( elements[i].value, 10 ) sumstat += ttt }