Multiple id's in a single JavaScript click event

前端 未结 7 586
生来不讨喜
生来不讨喜 2020-12-14 19:23

In JavaScript I am using click event to change chart data. Below is a method for click event.

$(\'#pro1\').click(function () {
            chart.series[0].up         


        
相关标签:
7条回答
  • 2020-12-14 19:54

    Using each function() you can do it

    var i =0;
    $("#pro"+i+", #pro"+i+", #pro"+i+"").each(function(){
                $(this).on('click', function(){
    chart.series[0].update({
         data: pro+i
    });
    
    });});
    
    0 讨论(0)
提交回复
热议问题