Multiple id's in a single JavaScript click event

前端 未结 7 617
生来不讨喜
生来不讨喜 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:44

    Try this:

    var that = this;
    $('#pro1,#pro2,#pro3').click(function () {
        chart.series[0].update({
            data: that[$(this).attr('id')];
        });
    });
    

提交回复
热议问题