Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 点击一个按钮会触发同一事件两次吗?Highcharts图例显示的奇怪行为_Jquery_Highcharts_Legend - Fatal编程技术网

Jquery 点击一个按钮会触发同一事件两次吗?Highcharts图例显示的奇怪行为

Jquery 点击一个按钮会触发同一事件两次吗?Highcharts图例显示的奇怪行为,jquery,highcharts,legend,Jquery,Highcharts,Legend,我有一个问题,点击一个按钮显示Highcharts图形的图例似乎会触发两个事件:一个打开它,然后一个再次关闭它。在我看来,好几个月的工作都很顺利。现在突然,不同的行为。。。我不明白为什么会这样。Grrr 这是HTML部分: 当点击“显示图例”时,它首先提醒我图例已关闭,然后将其打开。正确的行为。但是突然,它再次运行脚本,将其关闭。为什么呢 谢谢你的提示 请检查此项,以便回答 试试这些: 确保并检查您没有在HTML页面中意外地包含两次脚本 或 在单击之前取消绑定 伟大的非常感谢您的快速回复/解决

我有一个问题,点击一个按钮显示Highcharts图形的图例似乎会触发两个事件:一个打开它,然后一个再次关闭它。在我看来,好几个月的工作都很顺利。现在突然,不同的行为。。。我不明白为什么会这样。Grrr

这是HTML部分:

当点击“显示图例”时,它首先提醒我图例已关闭,然后将其打开。正确的行为。但是突然,它再次运行脚本,将其关闭。为什么呢

谢谢你的提示

请检查此项,以便回答

试试这些:

确保并检查您没有在HTML页面中意外地包含两次脚本

在单击之前取消绑定


伟大的非常感谢您的快速回复/解决方案!Stackoverflow的社区一次又一次给人留下深刻印象!
<body>

    <div class="cctabs" style="height: 780px; width: 1135px;">              

            <div id="div_graph" style="width: 1115px; height: 650px;"></div>
            <div style="text-align: right; margin-right: 50px">
                <button id="updateLegend" style="">Show Legend</button><br />
                <button id="showAll" style="margin-top: 5px">Show All</button>&nbsp;<button id="hideAll" >Hide All</button>
            </div>

    </div>
$('#updateLegend').click(function (e)
{
    var legend = chart.legend; 

    alert(legend.display);

    if(legend.display) {
        legend.group.hide();
        $('#updateLegend').html('Show Legend');
        legend.display = false;
    } else {
        legend.group.show();
        $('#updateLegend').html('Hide Legend');
        legend.display = true;
    }
});
$("#updateLegend").unbind('click');
$("#updateLegend")
.button()
.click(function () {
   // Functionality;
});