I have a dynamic list and need to select the before last item.
<ul class="album">
<li id='li-1'></li>
<!-- ... -->
<li id='li-8'></li>
<li id='li-9'></li>
<li class='drop-placeholder'>drag your favorites here</li>
</ul>
var lastLiId = $(".album li:last").attr("id"); // minus one?
You can use
.eq()with a negative value (-1is last) to getnfrom the end, like this:You can test it here.