On Jul 18, 2008, at 9:22 AM, Mike Alsup wrote:

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)');


You could also just use the slice() method :-)

$('div').slice(-2);


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to