Possible Duplicate:
Why does jQuery or a DOM method such as `getElementById` not find the element?
This Event listener works on jsFiddle, but not when I call it from my PHP page.
function addDice() {
var add = document.getElementById("add");
alert("test");
}
var el = document.getElementById("add");
el.addEventListener("click", addDice, false);
<li id="add">CAll ADD</li>
I have the script in my index page between the <Script>
tags, If I put an onclick="addDice"
in the <li>
tag it works, but not with the eventListener
.