Suppose you have a routine like the following to wire up click event handlers
getElements(\".board>div\").forEach(function(elem){
elem.addEventListener(\"cl
use one eventhandler
especially if you have many elements inside your board.
adding multiple eventlisteners slows down the browser.
js
function h(e){
alert(e.target.textContent)
}
document.getElementsByClassName('board')[0].onclick=h
or
document.querySelector('.board').addEventListener('click',h,false)
html
1234
example
http://jsfiddle.net/3csJ2/
in your case...
function h(e){
e.target.innerText==1||(alert('this is not 1')/*,...*/)
}
example 2
http://jsfiddle.net/3csJ2/1/
inside the handler function (h) this
is the 'board'.