JQuery learning 2 selector usage instructions _ jquery

Source: Internet
Author: User
Use the selector to select the elements in the html to be operated. 1. Use the basic selector of CSS:
A: match all link elements.
# *: Match the element with id *
. *: Matches the element of the CSS class *.
A # * id. * class: matches the id as * id and has a link element with the CSS class as * class.
The above is the style in CSS, Which is wrapped in $ ("") in jQuery, such as jQuery ("p a. Class ")

Take the sub-selector, container selector, and feature selector as an example:

The Code is as follows:

  • JQuery supports

    • CSS1

    • CSS2

    • CSS3

    • Basic XPath

    • Custom selectors

    • Form selectors

If you want to select the first list
  • The sub-Selector ul. myList> li> a should be used to perform operations on all links in. Instead, ul. myList li a cannot be like this because all these links are lists.
  • Child node of the element.
    Child selector: the parent node and the direct child node are separated by Angle brackets (>.
    Feature selector: Pack elements that match specific content. For example, select the link that contains the href value starting with http: //: a [href ^ = http: //]
    Input [type = text]: matches allElement
    P [title = ^ my]: matches all the title feature values starting with my

    Select by location
    A: first: The selector matches the first element on the page.
    P: odd, p: even match odd and even elements respectively.
    I will not give you an example of others. If necessary, you can find them on the relevant website.

  • Related Article

    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.