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