Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.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
Javascript 对象#<;对象>;没有方法';滚动到视图';_Javascript_Jquery - Fatal编程技术网

Javascript 对象#<;对象>;没有方法';滚动到视图';

Javascript 对象#<;对象>;没有方法';滚动到视图';,javascript,jquery,Javascript,Jquery,我似乎不明白为什么我会犯这个错误。我觉得这是一个常规的javascript函数 $(document).ready(function () { $(".linesresults input[type=submit]").click(function () { console.log('here'); //$('.lineslistwrap').scrollTop($('.lineslistwrap').scrollTop() +

我似乎不明白为什么我会犯这个错误。我觉得这是一个常规的javascript函数

 $(document).ready(function () {
        $(".linesresults input[type=submit]").click(function () {
            console.log('here');
            //$('.lineslistwrap').scrollTop($('.lineslistwrap').scrollTop() + $(this).parent().position().top);
            $(this).parent().scrollIntoView();
        });
    });
是Dom元素上的方法,
parent()
返回jquery对象,请重试

$(this).parent()[0].scrollIntoView();
“我觉得它是一个常规的javascript函数”,这就是为什么在jQuery对象上调用它时它不起作用的原因。