简体   繁体   English

选择器'nth-last-child(n)'不在chrome中工作

[英]selector 'nth-last-child(n)' not working in chrome

alert($('#Content_tab form .form-group:nth-last-child(2)').html());

this and more selection on nth-last-child(n) not working in chrome !! 这个和更多的选择在nth-last-child(n)不在chrome中工作!!

How ever they are working fine in all other browsers, like in IE8, Mozilla. 他们如何在所有其他浏览器中正常工作,例如IE8,Mozilla。

Please review my Site and source code 请查看我的网站源代码

you can find the code near line no. 你可以在行号附近找到代码。 502 502

Use this 用这个

$('#Content_tab form .form-group').eq(-2).html()

As a javascript developer, I don't like that selector at all. 作为一个javascript开发人员,我根本不喜欢那个选择器。 It is agains my rules to use that kind of selector. 我的规则是使用那种选择器。 It will be very non performant. 这将非常不具备性能。 You can give some class to that element while building your markup or this is even better. 您可以在构建标记时为该元素提供一些类,或者这样做更好。

$("#Content_tab").find(".form-group").eq(-2).html()

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

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