I have a <DIV>
which I'm using as a button like this :
<div id='project_1_task_2_is_done'
class='button_style_1_small' onClick='taskIsDone(1,2,"y");'>
Is done?
</div>
I want to change the onClick string value to taskIsDone(1,2,"n")
once the user clicks on it, and then, when it clicks again, back to taskIsDone(1,2,"y")
and so on.
I'm trying to accomplish this from the taskIsDone javascript function such as
if(is_done=='n'){
document.getElementById('project_' + project_id + '_task_' + task_id + '_is_done')
.onclick = "taskIsDone(" + project_id + "," + task_id + ",'y');"
}
but it's not working.
I looked over the net to more than 7-8 examples, most from here (Stackoverflow) but I'm not finding the answer to my question (which is basically changing dynamically the onclick string for that DIV id. I don't want to run a function, as most of the examples i found present, just want to change the onclick string value, modifying "y" to "n", and again "y", etc, for each click on the div button.
thanks!!