Google Charts: How to pass a parameter into a callback (JavaScript)?

后端 未结 1 1371
悲哀的现实
悲哀的现实 2021-01-27 01:39

I have a following code:

google.charts.setOnLoadCallback( drawChart );
function drawChart() { ... }

I need to pass a parameter called chartID i

相关标签:
1条回答
  • 2021-01-27 02:18

    one way is to add another function...

    google.charts.setOnLoadCallback(function () {
      drawChart(chartID);
    });
    
    function drawChart(chartID) { ... }
    
    0 讨论(0)
提交回复
热议问题