ie8中的jquery父选择器问题

发布于 2024-12-14 03:43:12 字数 500 浏览 4 评论 0原文

Jquery 父选择器在 IE8 中不起作用。它可以与其他浏览器(chrome、firefox、opera、safari)一起使用,

我使用它的方式如下:

comment = $(this).parent().parent().parent().find(".commentWrapper");

有什么想法吗?

--编辑--

抱歉造成误导 结果错误在下一行;

postId = $(this).parent().parent().find('input[name = "postId"]').val();

IE 开发工具显示此错误:

Object doesn't support this property or method

但是如果我像 var postId 一样声明 postId,它工作正常..但我不明白实际上是什么问题?

Jquery parent selector is not working in IE8..It's working with other browsers(chrome,firefox,opera,safari)

I'm using it like :

comment = $(this).parent().parent().parent().find(".commentWrapper");

Any idea?

--Edit--

Sorry for the misleading
Turns out error is next line ;

postId = $(this).parent().parent().find('input[name = "postId"]').val();

And IE Developer tool shows this error:

Object doesn't support this property or method

But if i declare postId like var postId, it's working fine.. But I didnt understand what is the problem actually?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨落□心尘 2024-12-21 03:43:12

如果您知道父选择器,最好使用parents('selector')。
http://api.jquery.com/parents/

if you know parent selector, better to use parents('selector').
http://api.jquery.com/parents/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文