jquery - Make div container clickable, except export button -
i want create highcharts chart whole div has onclick function, don't want export button handle event on click. should react normal export button.
i have tried jquery tricks avoid it, getting highcharts buttons class: highcharts-button, doesn't work :
jquery("#container").on('click', ':not(.highcharts-button, .highcharts-button *)', function(e){ e.stoppropagation(); alert('click'); }); here jsfiddle. (problem is: don't want see alert pop when click export button).
one way filter event target, e.g:
jquery("#container").on('click', function(e){ if ($(e.target).closest('.highcharts-button, .highcharts-contextmenu').length) return; e.stoppropagation(); alert('click'); });
Comments
Post a Comment