how to find an element by class and nam code example Example: get element by class name var y = document.getElementsByClassName('foo'); var aNode = y[0];