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.