jQuery selector: detailed use case of parent
Jun 23, 2017 am 11:31 AM:The definition and usage of the parent selector:
This selector matches elements that contain child elements or text.
Note: Spaces are also considered contained elements.
Grammar structure:
1 |
|
This selector is generally used in conjunction with other selectors, such as Class selector and Element selector, etc. wait. For example:
1 |
|
The above code can set the width of a div containing text or elements to 300px.
If not used with other selectors, the default state is to be used with the * selector, for example, $(":parent") is equivalent to $("*:parent").
Example code:
Example 1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
The above code can set the width of a div containing text or elements to 300 in a custom animation.
Example 2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
Since the above code does not specify a selector to be used with the :parent selector, it is used with the * selector by default, so the code can contain text and element's width is set to 300px in a custom animated way.
The above is the detailed content of jQuery selector: detailed use case of parent. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What software is crystaldiskmark? -How to use crystaldiskmark?

How to download foobar2000? -How to use foobar2000

BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange?

Teach you how to use the new advanced features of iOS 17.4 'Stolen Device Protection'

How to use the little black box cdkey
