Home  >  Article  >  What are the basic selectors in jquery?

What are the basic selectors in jquery?

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-05-29 13:44:183814browse

jquery has four basic selectors, namely: 1. Basic selector, which searches for DOM elements through element id, class and tag name. The syntax is "$("")"; 2. Hierarchical selection The filter is used to obtain specific elements, such as descendant elements, child elements, etc.; 3. The filter form selector is used to select elements in the form; 4. The filter selector is used to filter out the required DOM elements through specific filtering rules. , the selectors all start with ":".

What are the basic selectors in jquery?

Operating system for this tutorial: Windows 10 system, jQuery3.6.0 version, Dell G3 computer.

There are four basic selectors in jquery:

1. Basic selector

The basic selector is The most commonly used selector in JQuery is also the simplest selector.

Find DOM elements by element id, class and tag name (id can only be used once in a web page, class can be used repeatedly).

The so-called id in a web page can only be used once means that the id in a web page cannot be repeated, that is, it is unique.

Note: All selectors must use $("") outside, such as: ID selector $("#ID")

2, hierarchical selector

This method returns a JQuery object to perform chain operations.

If you want to obtain specific elements through the hierarchical relationship between DOM elements, such as descendant elements, child elements, adjacent elements, sibling elements, etc., you need to use a hierarchical selector.

Note: $("") is omitted

3. Filter selector form

The form filter selector is used for elements in the form

4. Filter selector

Use specific filtering rules to filter out the required DOM elements. The selectors all start with ":".

The above is the detailed content of What are the basic selectors in jquery?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn