Home > Web Front-end > JS Tutorial > body text

Jquery 过滤器(first,last,not,even,odd)的使用_jquery

WBOY
Release: 2016-05-16 17:02:49
Original
1180 people have browsed it

复制代码 代码如下:

$(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("偶数行");
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!