jQuery :last-of-type 选择器
定义和用法
:last-of-type 选择器选取属于其父元素的特定类型的最后一个子元素的所有元素。
提示:该选择器与 :nth-last-of-type(1) 相同。
提示:请使用 :first-of-type 选择器来选取属于其父元素的特定类型的第一个子元素的所有元素。
语法
$(":last-of-type")

尝试一下 - 实例
选取所有 <div> 元素的最后一个 <p> 元素
如何选取所有 <div> 元素的最后一个 <p> 元素。
:last、:last-child 和 :last-of-type 之间的不同
演示 :last、:last-child 和 :last-of-type 选择器之间的不同。
点我分享笔记
笔记需要是本篇文章的内容扩展!文章投稿,可点击这里
注册邀请码获取方式
分享笔记前必须登录!
注册邀请码获取方式
-->