//YOU NEED TO DO A LOOP OF THE ELEMENTS var elements = document.getElementsByClassName('editp'); for(var i=0; i<elements.length; i++) { elements[i].style.display='none'; }