[Echarts] Uncaught TypeError: Cannot read property ‘getAttribute‘ of null

E.g:

<div id = "echarts1"></div>
var myChart = echarts.init(document.getElementById('echarts1'));

The reason
is that the div with id echarts1 cannot be found when js is initialized.
Solution
Adjust the order and place js initialization after html execution.

Guess you like

Origin blog.csdn.net/weixin_43574277/article/details/114368057