How do I get the context of a canvas in a td when starting reference from tr? Example code:
<table>
<tr name='pool_row' id='swimming_pool'>
<td>
</td>
<td>
</td>
<td name='write_graphic'>
<canvas name='graphic' class='dataset_graphic' width='200' height='23'></canvas>
</td>
<td name='read_graphic'>
<canvas name='graphic' class='dataset_graphic' width='200' height='23'></canvas>
</td>
</tr>
<tr name='pool_row' id='hot_tub'>
<td>
</td>
<td>
</td>
<td name='write_graphic'>
<canvas name='graphic' class='dataset_graphic' width='200' height='23'></canvas>
</td>
<td name='read_graphic'>
<canvas name='graphic' class='dataset_graphic' width='200' height='23'></canvas>
</td>
</tr>
</table>
<script>
$("tr[name='pool_row']").each(function(){
//Get Data for all pools from DB
//Loop over them, when match is found
//by id draw something.
var ctx = $(this).find("td[name='write_graphic']").find("canvas").getContext('2d');
});
</script>
Obviously the real php generated table I'm working with is a lot more complicated. All this also goes in an setInterval function so it occurs every 1 second... but it's not applicable to the question, just the importance of it.