当前位置: 首页 > 未分类>阅读正文

jquery获取第一个或最后一个子元素

2022.7.22 朱丰华 849 次 留下评论 181字

jquery如何获取第一个或最后一个子元素?

通过children方法,children(“input:first-child”)

$(this).children(“input:first-child”).val();

$(this).children(“input:last-child”).val();

通过>选择器,$(“.items>input:first”)

本篇完,还有疑问?留下评论吧

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注