I’m creating a clickable calendar, where each cell can be marked ‘green’ or ‘red’. This should be recorded in the DB. I thought of dynamically assigning each <td> an informative id, e.g.
<td id="1-2013-16-1" class="green">16</td>
Then get the id with jQuery and send it to php using ajax, for every cell that has been clicked.
This is possible and working, but something tells me id’s are not meant for this. Is this a reasonable way to identify the info needs to be sent for each cell? Or, what is a better way of doing this?
Use HTML5 custom data attribute:
To get the value with jQuery:
You can set any number of
data-*attributes.