Is there an easy way to select the last li of each of these lists using jQuery?
<ul> <li>1</li> <li>2</li> <li>3</li> </ul> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> <ul> <li>1</li> <li>2</li> </ul>
I tried these two methods, but both of them return only one element.
$("ul li").last() $("ul li:last")
I would use the CSS: last-child pseudo-class, but since it was introduced in CSS3 and IE8 does not support it, I cannot
source share