Home > Web Front-end > JS Tutorial > The definition and usage of odd selector in jQuery_jquery

The definition and usage of odd selector in jQuery_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:25:00
Original
1567 people have browsed it

The examples in this article describe the definition and usage of the odd selector in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This selector matches elements with odd index values, counting from 0.
Grammatical structure:

Copy code The code is as follows:
$(":odd")

This selector is generally used in conjunction with other selectors, such as class selectors, element selectors, etc. For example:

Copy code The code is as follows:
$("li:odd)").css("color","green ")

The above code sets the font color in the li with an odd index in the li element collection to green.
If it is not used with other selectors, it will be used with the * selector by default. $(": odd") is equivalent to $("*: odd")
Example code:

Copy code The code is as follows:






Script Home





  • html area

  • div css area

  • jQuery Zone

  • Javascript Zone





I hope this article will be helpful to everyone’s jQuery programming.

Related labels:
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
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template