Home > Web Front-end > JS Tutorial > Use of Jquery filter (first, last, not, even, odd)_jquery

Use of Jquery filter (first, last, not, even, odd)_jquery

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

Copy code The code is as follows:

$(function(){
$(" #menu li:first").click(function(){
$(this).addClass("b");
});
$("#menu li:last").text ("last");//Insert the text "last" into the last li element in the li list with the id of menu
$("#menu li:first").text("first");//li list Insert the text "first" into the first li element
$("#menu li:not(.on)").text("on");//The style in the li list is not class="on" The li element inserts text "on"
$("#menu li:even").text("odd row");
$("#menu li:odd").text("even row") ;
});
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