我有一个<div>
在该 div 中有几个 <a>
标签。使用 jQuery,我想显示前四个 <a>
标签。
我已经用以下代码做到了这一点:
$('div.gallery-hor.read-more a:nth-of-type(-1n+4)').show();
有一个问题:IE* 及更高版本不支持 :nth-of-type()
代码。
是否有解决宽度 jQuery 跨浏览器解决此问题的方法?
最佳答案
http://docs.jquery.com/Selectors/lt#index
$('div.gallery-hor.read-more a:lt(4)').show();
关于jquery - 使用 jQuery 显示前四个子元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8834432/