programmatically trigger click event in svg rect element

前端 未结 2 1628
广开言路
广开言路 2021-01-03 04:45

How to programmatically trigger click event in svg rectangle element element? like :$(\"#targetElm\").triger(\"click\");

     

        
2条回答
  •  悲哀的现实
    2021-01-03 05:13

    You can use Highcharts' internal function called firePointEvent for this:

    var chart = Highcharts.chart('container', {
    
      series: [{
        type: 'column',
        data: [1],
        point: {
            events: {
            click: function() {
                console.log('Click event fired');
            }
          }
        }
      }]
    });
    
    chart.series[0].points[0].firePointEvent('click');
    

    Live demo: http://jsfiddle.net/BlackLabel/xbkwqzc5/

提交回复
热议问题