Jquery 过滤器(first,last,not,even,odd)的使用
2018-10-12 13:51
661 查看
$(function(){
$("#menu li:first").click(function(){
$(this).addClass("b");
});
$("#menu li:last").text("最后");//id为menu的li列表中最后一个li元素插入文字“最后”
$("#menu li:first").text("第一");//li列表中第一个li元素插入文字“第一”
$("#menu li:not(.on)").text("on");//li列表中样式不是class="on"的li元素插入文字“on”
$("#menu li:even").text("奇数行");
$("#menu li:odd").text("偶数行");
});
您可能感兴趣的文章:
相关文章推荐
- Jquery 过滤器(first,last,not,even,odd)的使用
- Jquery 过滤器(first,last,not,even,odd)应用
- jQuery——jQuery基础方法first()/last()/not(CSS选择器)/even/odd/eq(index)/gt(index)/lt(index)
- jquery基本过滤选择器:first :last :not(.myclass) :even :odd :eq(1) :gt(5) :lt(1) :header :animated :focus
- jquery过滤器(first,last,not,even,odd简单应用)
- 知识点七:jQuery 遍历 - 过滤first(), last() 和 eq(),filter() 和 not()
- jQuery 遍历 - 过滤---first--last---eq--not--filter方法(二十五)
- (原創) 如何将字符串前后的空白去除? (使用string.find_first_not_of, string.find_last_not_of) (C/C++)
- (转帖)如何将字符串前后的空白去除? (使用string.find_first_not_of, string.find_last_not_of) (C/C++)
- 如何将字符串前后的空白去除? (使用string.find_first_not_of, string.find_last_not_of) (C/C++)
- jquery笔记:筛选 eq,first,last,filter,is,has, not, children,closest, nextUntil,parents,parentsUntil.....
- first-child 和 last-child的使用
- 关于使用JQuery时 定义$(funtion(){});时出现Uncaught ReferenceError: $ is not defined的错误
- jQuery 选择器 first-child和first-of-type、 last-child和last-of-type的区别
- CSS nth-child、first-child、last-child、nth-of-type、first-of-type和last-of-type选择器使用
- jQuery中:first,:first-child,first()的使用区别
- jQuery原型方法first,last,eq,slice源码分析
- jquery插件-zTree 使用出现- NotSupportedError: DOM Exception 9 错误
- C++基础---string类的find/find_first_of/find_first_not_of/rfind/find_last_of/find_last_not_of
- 18/2/05.JQuery的学习(三)——使用过滤器