Home > Web Front-end > JS Tutorial > jQuery descendant selector usage example_jquery

jQuery descendant selector usage example_jquery

WBOY
Release: 2016-05-16 16:24:51
Original
1293 people have browsed it

The example in this article describes the usage of jQuery descendant selector. Share it with everyone for your reference. The specific analysis is as follows:

The descendant selector matches all descendant elements that are matched under the given ancestor element.

Click the selector to view all jQuery selectors in the reference manual.

The code example is as follows:

Copy code The code is as follows:
$(".mydiv span")

The above code matches the span element contained in the class name mydiv element. Two selectors should be separated by a space.
Example code:

Copy code The code is as follows:






Script Home






Script Home


Script Home




This example can set the text color in the span element under the div with the class name mydiv to red.

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

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