3.:has (selector) filter Selector

Source: Internet
Author: User

In addition to using the included string content filtering elements described in the previous section, you can also use the contained element names to filter the :has(selector) function of the filter selector to get all the elements in the selector that contain the specified element name, where selector the parameter is the element name that is contained and is the contained element.

For example, get all the <li> elements that specify the name of an element, and change the color of their display text, as shown in:

Effects displayed in the browser:

As you can see, by using $("li:has(‘p‘)") selector code, you get all <li> elements that contain the <p> element and change the text style that these elements display on the page through CSS methods.

Task

I'll try it: find it for yourself "L Sister paper "

At the 18th line of the page, use the :has(selector) selector to get all <li> elements that contain the <label> name and change the background color they display.

3.:has (selector) 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.