简体   繁体   English

scrollTop不起作用

[英]scrollTop doesn't work

My code - 我的代码-

($("div[id$='fixedDataDiv']")[0]).scrollTop(0);

This is called when I change tabs in IE8. 当我在IE8中更改选项卡时,将调用此选项。

The error message I get is - 我收到的错误消息是-

Microsoft JScript runtime error: Object doesn't support this action

Is my syntax incorrect? 我的语法不正确吗?

If you want to select the first matched element you can try: 如果要选择第一个匹配的元素,可以尝试:

$("div[id$='fixedDataDiv']:first").scrollTop(0);

scrollTop() is one of jQuery object's methods, [0] converts the jQuery Object to a DOM element which has no scrollTop() method. scrollTop()是jQuery对象的方法之一, [0]将jQuery Object转换为没有scrollTop()方法的DOM元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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