I have a dynamic list and need to select the before last item.
&l
You can use .eq() with a negative value (-1 is last) to get n from the end, like this:
-1
n
$(".album li").eq(-2).attr("id"); // gets "li-9"
You can test it here.