The method querySelectorAll() returns a NodeList which is a collection of nodes.
Hence you need to iterate it to attach event listeners
var el = document.querySelectorAll('.block');
for(var i=0; i < el.length; i++){
el[i].addEventListener('click', function () {
alert('hello');
}, false);
}