Step-by-step learning JQuery (iv) filter Selector: attribute filter selector && child element filter Selector && form Filter Selector

Source: Internet
Author: User

Iv. Attribute Filter Selector

The filter rule for a property filter selector is to get the corresponding element through the attributes of the element


Select the following element to change its background color to # BBFFAA
The div element that contains the title of the property.
The attribute title value equals the div element "test".
The attribute title value is not equal to the div element of "test" (it will also be selected without the attribute title).
Property The div element with the title value starting with "TE".
Attribute the title value to the div element ending with "est".
The attribute title value contains the div element "es".
Select the div element with the attribute ID, and then in the result, select the div element with the title value containing "es".


Five, sub-element filter selector

The Nth-child () selector is detailed below:
(1): Nth-child (even/odd): can select an element with an index value of even (odd) number under each parent element
(2): Nth-child (2): can select an element with an index value of 2 under each parent element
(3): Nth-child (3n): An element that can select a multiple of 3 of the index value under each parent element
(3): Nth-child (3n + 1): The index value under each parent element can be selected as an element of 3n + 1

Select the following element to change its background color to # BBFFAA
Each class is the 2nd child element under the div parent element of one.
Each class is the first child element under the div parent element of one
Each class is the last child element under the div parent element of one
If class is just a single child element under the div parent element of one, select this child element



vi. Form Filter selector

This selector primarily filters the selected form elements

Use the Val () method of the JQuery object to change the values of the available <input> elements in the form
Use the Val () method of the JQuery object to change the value of the unavailable <input> element in the form
Use the Length property of the JQuery object to get the number of selected boxes
Use the text () method of the JQuery object to get the contents of the drop-down box selected



Step-by-step learning JQuery (iv) filter Selector: attribute filter selector && child element filter Selector && form Filter Selector

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.