开发者

how to achieve .eq(-1) in jQuery older than 1.4?

$(selector).eq(-开发者_Go百科1)

I spent some time to find why the above script doesn't work for me,

it's because I'm not using jQuery 1.4

How to achieve the same in older jQuery?


Try this

var sLen = $(selector).length;
$(selector).eq(sLen-1);


Something like this should work:

var es = $(selector);

and then

es.get(es.length - 1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜