用jQuery选择最后5个元素 [英] Select last 5 elements with jQuery
本文介绍了用jQuery选择最后5个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以选择元素的最后5个子div?
Is it possible to select the last 5 child divs of an element?
推荐答案
,然后使用 slice
方法获取最后五个:
Yes, you can get the div elements, and then use the slice
method to get the last five:
var e = $('#someelement > div').slice(-5);
这篇关于用jQuery选择最后5个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文