我有 4 个图表,每个图表在 html 中都有自己的 div。我试图找到将这些图表自动添加到数组中的最佳方法,而无需在更改图表及其 ID 时更新数组。
HTML:
<table id="dashboard" cellpadding="0" cellspacing="0">
<tr>
<td id="c1"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
<td id="c2"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
</tr>
<tr>
<td id="c3"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
<td id="c4"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
<!--<td id="BottomRight"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>-->
</tr>
</table>
JS:
var arrOfChartContainers = ["c1","c2","c3","c4"]; <-- I want to automate this