> The selector can match last one elememt by using ":last", but how
> about last n elements?Are there some simple way to do this?

You could create a new selector shortcut for that case like this:

jQuery.expr[':'].lastx = function(a,i,m,r){return i>=r.length-m[3];};

And then use it like this:

var lastTwoDivs = $('div:lastx(2)');

Reply via email to