Introduction to JQuery's various selectors
1. JQuery basic selector
2. Hierarchy Selector
express description remarks $("#idName") id selector ##$(".className") Class Selector $("tagName") Tag Selector $("*") ##$("tagName,.className,#idName,. ..")Wildcard selector Group Selector
Select nodes from the parent-child relationship and brother relationship.
express
$("a b") description remarks Select all descendant nodes b (including child nodes and Grandchild node)
##$("a>b") Select all child nodes b (including only child nodes of node a , excluding grandchild nodes)
$("a+b") Select the first sibling node b## after node a Select all sibling nodes b after node a#$("a~b") Note that it is after node a Sibling nodes, instead of all sibling nodes
3. Basic filter selector
Filter tags from the perspective of position.
4. Content filter selector
express description remarks $("tagName:first") Select the first element in the tagName element collection $("tagName:last") Select the tagName element The last element in the collection $("tagName:odd") Select the element at an odd position in the tagName element collection $("tagName:even") Select the even-numbered element in the tagName element set $("tagName:eq(1)") Select the second element in the tagName element collection
(The index is the same as the array, starting from zero)##$("tagName:gt(2)") Select the elements after the third element in the tagName element set (i.e. under tagName , elements with positions greater than 3)
$("tagName:lt(2)") Select the third element in the tagName element set The element in front of the element (that is, the element under tagName with a position less than 3)
$(":header") Select all title elements (h1 to h6)
$(":animated") Select animated elements $("tagName:not(.one)") Select elements whose class value is not one in the tagName element set Whether the node value is empty, Whether the text on the node contains the specified string, and whether the class value in the child element is the specified value.
express description remarks $("tagName:empty") Select elements with empty content in the tagName element collection (Not a child element)
$("tagName:parent") Select elements that contain child elements in the tagName element set $("tagName:contents('abc')") Select the element whose content contains "abc" in the tagName element set (Not a child element)
$("tagName:has(.one)") Select the class value in the tagNmae element set as element of one (not a child element, but a tagName element)
5. Attribute filter (select elements containing specified attributes)
Filter nodes based on their attributes: with or without attributes, Attribute values are equal to, not equal to, include, start with **, end with **, multiple filtering.
6. Visibility filter selector
#express description remarks $("div[id]") ##$("div[id='test']")The selected element contains the id attribute $("div[title!='test']") The selected element contains id="test" $("div[title^='te']") The title attribute of the selected element is not "test" $("div[title$='st']") The title attribute value of the selected element starts with "test" $("div[title*='est']") The title attribute of the selected element ends with "test" $("div[title*='est'][id]") The title attribute value of the selected element contains "est" The title attribute value of the selected element contains "est", And has the id attribute
Select nodes based on whether elements on the page are displayed
##express
description remarks $("div:hidden") Select the hidden div element $("div :hidden") Select all hidden elements in the div element (including child elements and grandchild elements)
$("div:visiable") Select visible div elements $("div :visiable") Select the visible elements in the div (including child elements and grandchild elements)
The above is the detailed content of Introduction to JQuery's various selectors. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

When editing text content in Word, you sometimes need to enter formula symbols. Some guys don’t know how to input the root number in Word, so Xiaomian asked me to share with my friends a tutorial on how to input the root number in Word. Hope it helps my friends. First, open the Word software on your computer, then open the file you want to edit, and move the cursor to the location where you need to insert the root sign, refer to the picture example below. 2. Select [Insert], and then select [Formula] in the symbol. As shown in the red circle in the picture below: 3. Then select [Insert New Formula] below. As shown in the red circle in the picture below: 4. Select [Radical Formula], and then select the appropriate root sign. As shown in the red circle in the picture below:

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <

Title: Learn the main function in Go language from scratch. As a simple and efficient programming language, Go language is favored by developers. In the Go language, the main function is an entry function, and every Go program must contain the main function as the entry point of the program. This article will introduce how to learn the main function in Go language from scratch and provide specific code examples. 1. First, we need to install the Go language development environment. You can go to the official website (https://golang.org

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

As a lifestyle sharing platform, Xiaohongshu covers notes in various fields such as food, travel, and beauty. Many users want to share their notes on Xiaohongshu but don’t know how to do it. In this article, we will detail the process of posting notes on Xiaohongshu and explore how to block specific users on the platform. 1. How to publish notes tutorial on Xiaohongshu? 1. Register and log in: First, you need to download the Xiaohongshu APP on your mobile phone and complete the registration and login. It is very important to complete your personal information in the personal center. By uploading your avatar, filling in your nickname and personal introduction, you can make it easier for other users to understand your information, and also help them pay better attention to your notes. 3. Select the publishing channel: At the bottom of the homepage, click the "Send Notes" button and select the channel you want to publish.
