Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.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 更改功能在Chrome中停止工作_Jquery_Google Chrome - Fatal编程技术网

Jquery 更改功能在Chrome中停止工作

Jquery 更改功能在Chrome中停止工作,jquery,google-chrome,Jquery,Google Chrome,我有一个简单的更改功能: function checkradio() { $("input.checkbox_check").change(function(){ if ($(this).prop('checked')) { console.log('checked'); var here = $(this).attr("id"); console.log(here); $(

我有一个简单的更改功能:

function checkradio() {
    $("input.checkbox_check").change(function(){
        if ($(this).prop('checked')) {
            console.log('checked');
            var here = $(this).attr("id");

            console.log(here);
            $('.' + here).addClass("line_marked");
            $('.' + here).removeClass("hide");
            $('.' + here).removeClass("inactive");
        } 
        else {
            var here = $(this).attr("id");
            console.log(here);

            $('.' + here).removeClass("line_marked");
            $('.' + here).addClass("inactive");
            $('.' + here).addClass("hide");

            console.log(here);
            console.log('not checked');
        }
    });
}
它检查是否选中了多个复选框,获取选中复选框的id,然后将两个css类添加到具有相应id类的折线图(内置于d3中)中并将其删除

该操作取决于复选框是否选中

这在除Chrome之外的所有浏览器(不是ie8)中都能完美工作。在chrome中,只要我继续单击复选框,它就可以正常工作。但是如果我在车窗打开的情况下等待大约40秒,更改功能将停止工作。然后,我必须单击并松开复选框,然后它才能再次开始工作


我在控制台中没有收到错误消息

您在控制台o/p中看到了什么?您在哪里调用
checkradio()
?您是否可能多次调用它(比如从ajax函数的回调或在循环中调用)?好问题,我确实收到了console.log消息。因此,函数将启动,但相关css类不会被添加/删除。不,它的调用类似于checkradio();在$(function(){})中,您似乎希望在这里使用class$('.+here),但您使用的是id
$(this.attr(“id”)