简体   繁体   中英

How to access highstock zoom buttons via jquery?

Is there a way to access highstock zoom buttons via jquery as follows

$('.highcharts-range-selector-buttons').attr('user', 'free');

I want to add a new attribute to the range selector buttons.

Yes, but you need to wait until the range selector is rendered. Eg it is rendered before load event, so you can grab the element there.

chart: {
  type: 'arearange',
  events: {
    load: function() {
      const el = $('.highcharts-range-selector-buttons').attr('user', 'free')
      console.log(el.attr('user'))
    }
  }
},

The class you have is for the group which includes buttons. Range selector buttons have classes highcharts-button [highcharts-button-pressed / highcharts-button-normal]

example: http://jsfiddle.net/v2gv7um1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM