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

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

WBOY
WBOYOriginal
2016-05-16 17:02:491218browse

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") ;
});
Statement:
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