var content=document.getElementsByClassName(clasS); for(var i=0;i<content.length;i++){ if(content[i].tagName !="a"){ content=content[i]; } }