Get last li on a line jQuery
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: We have a simple ul <ul> <li> some text </li> <li> some some text </li> <li> text more </li> <li> text here </li> </ul> ul { text-align: center; width: 100px; } li { width: auto; display: inline; } So the ul can have several lines. How do I take last li of the each line inside ul ? 回答1: If by last li on the each line of the ul you mean the last li in each ul , then: $ ( 'ul li:last-child' ); However, if you mean that you have your li 's within the same ul written up on several lines in your source code, and you now want to get the