简体   繁体   中英

Target first li element with div class on page Jquery

In jQuery I am trying to target the first li element on a page within a specific div> I am also getting the length (count) of it. The code I have so far does not work? Any ideas?

var Count = $(item).find('.item-colours ul li').first.length;

您可以将“第一”部分放在查询中:

$(item).find('.item-colours ul li:first-of-type')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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