Current location - Quotes Website - Personality signature - How to get the elements under div with Jquery
How to get the elements under div with Jquery

1. For example, we want to get or get this div element.

2. We can do this by using $("div"), which is obtained directly through the element name. Be careful to add quotation marks.

3. Or you can add a class to the element, as shown in the picture, I added a bd class.

4. Then we can also get the div element by using $(".bd"). Note that the class name requires a dot.

5. In addition, ID is also a good method, but there can only be one ID and no duplicate names.

6. In jQuery, the ID must be added with a # sign to be valid.

7. Finally, I sorted out some of the more commonly used methods of obtaining elements in jQuery.