The jquery selector is divided into: basic selector, hierarchy selector, filter selector and form selector.
1. Basic Selector
The basic selector is the most commonly used selector in jquery and the simplest selector.
2. Hierarchy Selector
Hierarchical selectors are a good choice if you want to get specific elements, such as descendant elements, child elements, neighboring elements, and sibling elements, through hierarchical relationships between the DOM.
In the hierarchy selector, the first and second choices are common, and the next two in jquery can be replaced in a simpler way, so the chances of using them are relatively small.
3. Filter Selector
The filter selector primarily filters out the required DOM elements through a specific filtering rule, which is the same as the pseudo-class selector syntax in CSS, where the selector begins with a colon (:). According to different filtering rules, filter selectors can be divided into basic filtering, content filtering, visibility filtering, attribute filtering, sub-element filtering and Form object property filter selectors.
3.1. Basic Filter Selector
3.2. Content Filter Selector
The filtering rules of the Content filter selector are mainly embodied in the sub-elements or text content that it contains.
3.3. Visibility Filter Selector
The visibility selector selects the appropriate element based on the visible and invisible state of the element.
In the visibility selector, you need to be aware of the selector: hidden, which not only includes elements that have the Style property display as "None", but also elements such as text-hidden fields (<input type= "hidden" >) and Visibility:hidden.
3.4. Attribute Filter Selector
The filter rule for a property filter selector is to get the corresponding element through the attributes of the element.
3.5. Child element Filter Selector
Filter rules for child element filter selectors be aware of the distinction between the parent and child elements of an element.
3.6. Form object property Filter Selector
The Form object property filter Selector mainly filters the selected form elements, such as selecting the Selected drop-down box, multi-box, and so on.
4. Form Selector
In order to be able to operate the form more flexibly, jquery has specifically added a form selector, which allows it to easily get to one or more elements of the form.
The razor-sharp jquery Learning notes jquery Selector