In JavaScript, I use the click event to modify chart data. The following is the click event method.
$('#pro1').click(function () { chart.series[0].update({ data: pro1 }); }); $('#pro2').click(function () { chart.series[0].update({ data: pro2 }); }); $('#pro3').click(function () { chart.series[0].update({ data: pro3 }); });
I need to minimize these three click events in a single event, which means I want to write a single click event that processes identifiers. something like the code below.
$('#pro'+i).click(function () { chart.series[0].update({ data: pro+i }); });
I do not know how to do that. The above code is incorrect, it's just a lack of JavaScript knowledge.
javascript jquery event-handling click
MAR
source share