let blocks = document.querySelectorAll('.foo')
setInterval(function(){
blocks.forEach(block => {
block.textContent = +block.textContent + 1
})
}, 500)
https://jsfiddle.net/32jufnm8/let blocks = $('.foo')
setInterval(function(){
blocks.each(function(){
this.textContent = +this.textContent + 1
})
}, 500)
https://jsfiddle.net/32jufnm8/1/