jquery Union selector, relative selection and Hierarchy selector __ Multi-class intersection selector, multi-attribute Selector

Source: Internet
Author: User

1. Multi-Criteria Selector

Purpose: Select multiple labels at the same time using multiple criteria

Usage: $ ("Condition 1, Condition 2, Condition 3, ..., condition n");

Characteristics: Multiple conditions are separated by commas within "";

Use Case: $ ("div#id,span.tip,p"); Also select the DIV tag with id "id", the span label with the class "tip" and the P tag; 2, relative selector

Purpose: Use the second parameter to select a relative element without affecting other elements with the same conditions

Usage: $ ("Condition 1", condition 2);

Features: two parameters

Case:

$ ("TD", (this)). CSS ("Background", "Red");



The TD element background of the current TR is red, and the TD in the other TR is unchanged; 3, Hierarchy selector

Purpose: Select descendant nodes

Usage: $ ("Condition 1 Condition 2 Condition 3");

Characteristics: Double quotation marks, between the conditions separated by a space;

Use Case: $ ("#com ul Li");

Select all LI nodes inside ul of the element with ID as COM;

JQuery Selects an implementation method that contains two class elements

<element class= "a B" >


?

1. Intersection Selection: $ (". A.b")--Select the element that contains both A and B.

2. The set selection: $ (". A,. B")--Select the element that contains a or contains B.


Select E[attr=val][attr=val based on multiple attributes]

$ ("div[title= ' ttt '][class= ' aaaa ']"). Click ()



All attributes under all DIV elements the title value is equal to TTT and the attribute class equals AAAA element


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.