I try to do like a questionnary, when you click on 1 answer, that check if it's the good answer and then desactivate the onclick event, after clicking on an other button to change the question and add new answer i want to reactivate the click but i dont know how to do this in javascript :/
Here the code for better explanation x):
<ol id="answerList" type="A">
<img class="imgLine" src="" id="answer-a-img" /><li onclick="clickLine(this);" id="answer-a" ></li>
<img class="imgLine" src="" id="answer-b-img" /><li onclick="clickLine(this);" id="answer-b" ></li>
<img class="imgLine" src="" id="answer-c-img" /><li onclick="clickLine(this);" id="answer-c" ></li>
<img class="imgLine" src="" id="answer-d-img" /><li onclick="clickLine(this);" id="answer-d" ></li>
</ol>
Here is the answer and the onclick event is working and that call clickLine function
I desactivated the onclick event by doing this: (i know it's not clean but i didnt saw an other way :/)
document.getElementById('answer-a').onclick = "";
document.getElementById('answer-b').onclick = "";
document.getElementById('answer-c').onclick = "";
document.getElementById('answer-d').onclick = "";
but now, when i got new datas, i dont success to reactivate onclickevent, i tried this:
document.getElementById('answer-a').onclick = "clickLine(this);";
document.getElementById('answer-b').onclick = "clickLine(this);";
document.getElementById('answer-c').onclick = "clickLine(this);";
document.getElementById('answer-d').onclick = "clickLine(this);";
but didnt worked :/
thanks !
ps: I can use Jquery if there is a solution in it ^^