84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
$("li:gt(2)")这种会用,但是很久以前看见过一个jquery变量转变成XX然后又使用了:gt(2)这种,比如var $li=$("li"),我需要在$li这个变量基础上使用:gt(2),也不知道大家明白了我的意思没有,急求解答,很久以前在一个博客上看见的,但是不记得了。
人生最曼妙的风景,竟是内心的淡定与从容!
$li.filter(':gt(2)')
这样?
jquery 本身是没有,t这种方法,只有这个选择器,不过你可以扩展下不
$.fn.gt = function(num){ var after = []; this.each(function(i){ if(i>=num){ after.push(this); } }); return after; } $.fn.lt = function(num){ var before = []; this.each(function(i){ if(i<num){ before.push(this); } }); return before; }
这样?
jquery 本身是没有,t这种方法,只有这个选择器,不过你可以扩展下不