In the continuation of the study of the dark world javascript I ask for help in this question: there is an array of buttons (like a calculator)
<button>1</button><button>2</button><button>3</button><button>4</button><button>5</button><button>6</button><button>7</button><button>8</button><button>9</button><button>0</button>
need when you press the key to read the value of the digit. I tried this method:
javascript code: var buttons = document.getElementsByTagName('button'); buttons.addEventListener('click', function(e){ console.log(e.target.innerHTML); });
what is the error in the console
Uncaught TypeError: Object #NodeList has no method 'addEventListener'
indicating the line
buttons.addEventListener('click', function(e){
I can not find the info, maybe I just do not know where to dig. I understand that he does not want to bind the handler to the collection of items. Plz tell me