mail.innerHTML is that mailDiv.innerHTML ? is mail to be found inside mailDiv ?
I would put each separate mail inside a separate div, give it an id (maybe equal to the mail id). Will you make a separate button for each mail? You could make it a child of that div, and then with event.target you could get to the parent and thus at the contents of the div. I think ‘event.target’ will be a great help.
yeah that was a typo(supposed to be mailDiv), corrected. I have got emails in the inbox already, my problem is the clicking bit. I tried to give each div same id as email but ids cannot start with a number and I have tried substr on the id but doesn’t seem to work. Is there any way around it?