I've got a quick question: I've got a function that stores id's in an array called "view1". When a certain requirement is met, I want these id's onclick to change. I want them to load a function called clickMem(id) when they are clicked, and also send in their id in the function. So I've tried this with the first id in the array and it didn't work, what am I doing wrong?
document.getElementById(view1[0]).onclick='clickMem('+view1[0]+');';
Thank you in advance!
onclickexpects a function, not a string. See developer.mozilla.org/en-US/docs/Web/API/…