ie8中的jquery父选择器问题
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您知道父选择器,最好使用parents('selector')。
http://api.jquery.com/parents/
if you know parent selector, better to use parents('selector').
http://api.jquery.com/parents/